Exemplo n.º 1
0
    def __init__(
            self, mixer,
            bus):  #mixer is global variable, so it can be accessed everywhere
        self.mixer = mixer
        self.channel_structure = channels(
            120, 4, 4, bus)  #2 channels, 4 steps, bpm not implememted yet!!!

        #use this code when hooked up to pi!!!!
        #self.channel_structure.init_analog_inputs()
        self.channel_structure.scan_tracks()

        #this code is for testing on mac
        #self.channel_structure.set_audio_num(0,0, "010")#testing sounds, because scan method not fully implementd
        #self.channel_structure.set_audio_num(1,3, "010")
        self.channel_structure.print_audio_file_struct()  #not permanent
Exemplo n.º 2
0
"""audio loop driver method"""
import time
from gpiozero import MCP3008, PWMLED
from channel_structure import channels
from sound_files import mix

#setting up volume knobs
pot0 = MCP3008(0)  #channel 0 of the MPC3008 pins
pot1 = MCP3008(1)  #MCP3008 channel 1

#settig up channel data
sequencer = channels(5)  #5 is the tempo
sequencer.scan_tracks  #not implemented yet
print(sequencer.audio_file_struct[0])
print(sequencer.audio_file_struct[1])
tempo = sequencer.tempo

mixer = mix()

#Clock = pygame.time.Clock
#clock = Clock()


def play_region(region_number):
    mixer.play(sequencer.get_audio_num(0, region_number), 0)
    mixer.play(sequencer.get_audio_num(1, region_number), 1)


mixer.update_channel_volume(
    0, pot0.value)  #setup the channel volumes before audio playback
mixer.update_channel_volume(1, pot1.value)