def __init__(self, styleCallback): super(StyleSelection, self).__init__() Window.clearcolor = (0.2, 0.2, 0.2, 0.5) self.label = topleft_label() self.label.text = "Welcome! Select a style to begin." self.add_widget(self.label) self.orientation = "vertical" self.button_size = (900, 400) title = BetterButton("", (1400, 620), (0, 0), lambda x: x, "StyL") title.background_normal = "../img/styl.png" self.title = title b1 = BetterButton("", self.button_size, (0, 0), styleCallback, "Chainsmokers") b1.background_normal = "../img/chainsmokers.png" self.option1 = b1 b2 = BetterButton("", self.button_size, (0, 0), styleCallback, "Ed Sheeran") b2.background_normal = "../img/sheeran.png" self.option2 = b2 self.add_widget(self.option1) self.add_widget(self.option2) self.add_widget(self.title)
def __init__(self): super(MainWidget, self).__init__() self.audio = Audio(2) self.synth = Synth('../data/FluidR3_GM.sf2') # create TempoMap, AudioScheduler self.tempo_map = SimpleTempoMap(120) self.sched = AudioScheduler(self.tempo_map) # connect scheduler into audio system self.audio.set_generator(self.sched) self.sched.set_generator(self.synth) # create the metronome: self.metro = Metronome(self.sched, self.synth) # Note Sequencers self.seq1 = NoteSequencer(self.sched, self.synth, 1, (0, 65), kYesterday, False) self.seq2 = NoteSequencer(self.sched, self.synth, 2, (0, 52), kSomewhere, True) # and text to display our status self.label = topleft_label() self.add_widget(self.label)
def __init__(self): super(ExerciseWidget, self).__init__() self.anim_group = AnimGroup() self.canvas.add(self.anim_group) self.line = TriangleA() self.anim_group.add(self.line) self.info = topleft_label() self.add_widget(self.info) self.last_touch = None
def __init__(self): super(MainWidget2, self).__init__() self.audio = Audio(2) self.synth = Synth('../data/FluidR3_GM.sf2') # create TempoMap, AudioScheduler self.tempo_map = SimpleTempoMap(120) self.sched = AudioScheduler(self.tempo_map) # connect scheduler into audio system self.audio.set_generator(self.sched) self.sched.set_generator(self.synth) # create the metronome: self.metro = Metronome(self.sched, self.synth) # create the arpeggiator: self.arpeg = Arpeggiator(self.sched, self.synth, channel = 1, program = (0,0) ) self.arpeg.set_direction('updown') #size of the notes sent to the arpeggiator self.arpegSize = 3 #all of the notes this program can make. However, only self.arpegSize notes are sent to the arpegiator at a time self.allNotes = [50, 53, 55, 56, 57, 60, 62, 65, 67, 68, 69, 72, 74] self.lastPitchIndex = None self.lastPulseIndex = None self.noteLengths = [240, 210, 180, 150, 120, 90, 60] self.articulation = .75 # and text to display our status self.label = topleft_label() self.add_widget(self.label) # and text to display our status self.label = topleft_label() self.add_widget(self.label) self.objects = AnimGroup() self.canvas.add(self.objects) self.add_lines()
def __init__(self): super(MainWidget2, self).__init__() # create a clock and a tempo map self.clock = Clock() self.tempo_map = SimpleTempoMap(120) # and text to display our status self.label = topleft_label() self.add_widget(self.label)
def __init__(self, **kwargs): super(MainScreen, self).__init__(**kwargs) mode = 'mac' if (len(sys.argv) == 2) and (sys.argv[1] == 'mac') else 'pc' self.norm = Normalizer(mode) self.info = topleft_label() self.add_widget(self.info) self.writer = AudioWriter('recordings/song') self.audio = Audio(2, self.writer.add_audio) self.mixer = Mixer() self.mixer.set_gain(1.0) self.audio.set_generator(self.mixer) self.sandbox = Sandbox(canvas=self.canvas, pos=self.norm.nt((580, 50)), size=self.norm.nt((1000, 1000))) # since putting all our sound module code in MainScreen would be a nightmare, we've # modularized our modules into separate files. each module has two classes, the sound # module itself and its handler class. the handler class is essentially a wrapper of # many of MainScreen's important event functions (e.g. on_touch_down) that keeps track # of all variables related to that sound module for every connected client. self.module_dict = { 'PhysicsBubble': PhysicsBubble, 'SoundBlock': SoundBlock, 'TempoCursor': TempoCursor } block = SoundBlockHandler(self.norm, self.sandbox, self.mixer, client, client_id) self.module_handlers = { 'SoundBlock': block, 'PhysicsBubble': PhysicsBubbleHandler(self.norm, self.sandbox, self.mixer, client, client_id, block), 'TempoCursor': TempoCursorHandler(self.norm, self.sandbox, self.mixer, client, client_id, block) } # name a default starting module and handler self.module = PhysicsBubble self.module_handler = self.module_handlers[self.module.name] self.sandbox.add(self.module_handler.gui) # sync with existing server state client.emit('sync_module_state', {'module': 'PhysicsBubble'}) client.emit('sync_module_state', {'module': 'SoundBlock'}) client.emit('sync_module_state', {'module': 'TempoCursor'}) client.emit('update_norm', {'norm': {client_id: self.norm.mode}})
def __init__(self): super(MainWidget3, self).__init__() # create a clock and TempoMap self.clock = Clock() self.tempo = SimpleTempoMap(120) # create a Scheduler self.sched = Scheduler(self.clock, self.tempo) # and text to display our status self.label = topleft_label() self.add_widget(self.label) # to see accumulated output: self.output_text = ''
def __init__(self): super(MainWidget4, self).__init__() self.audio = Audio(2) self.synth = Synth('../data/FluidR3_GM.sf2') self.audio.set_generator(self.synth) # create clock, tempo_map, scheduler self.clock = Clock() self.tempo_map = SimpleTempoMap(120) self.sched = Scheduler(self.clock, self.tempo_map) # create the metronome: self.metro = Metronome(self.sched, self.synth) # and text to display our status self.label = topleft_label() self.add_widget(self.label)
def __init__(self): super(MainWidget5, self).__init__() self.audio = Audio(2) self.synth = Synth('../data/FluidR3_GM.sf2') # create TempoMap, AudioScheduler self.tempo_map = SimpleTempoMap(120) self.sched = AudioScheduler(self.tempo_map) # connect scheduler into audio system self.audio.set_generator(self.sched) self.sched.set_generator(self.synth) # create the metronome: self.metro = Metronome(self.sched, self.synth) # and text to display our status self.label = topleft_label() self.add_widget(self.label)
def __init__(self): super(MainWidget1, self).__init__() self.audio = Audio(2) self.synth = Synth('../data/FluidR3_GM.sf2') self.audio.set_generator(self.synth) self.label = topleft_label() self.add_widget(self.label) cc_range = range(0, 128, 8) self.modifier = Modifier() self.modifier.add('a', "program", range(128), lambda x: self.synth.program_change(0, x)) self.modifier.add('s', "vibrato", cc_range, lambda x: self.synth.cc(0, 1, x)) self.modifier.add('d', "volume", cc_range, lambda x: self.synth.cc(0, 7, x)) self.modifier.add('f', "sustain", (0, 127), lambda x: self.synth.cc(0, 64, x)) self.modifier.add('z', "bend", range(-8192, 8192, 256), lambda x: self.synth.pitch_bend(0, int(x)))
def __init__(self): super(MainWidget, self).__init__() self.audio = Audio(2, input_func=self.receive_audio, num_input_channels=1) self.mixer = Mixer() self.audio.set_generator(self.mixer) self.pitch = PitchDetector() self.recorder = VoiceAudioWriter('data') self.info = topleft_label() self.add_widget(self.info) self.anim_group = AnimGroup() self.mic_meter = MeterDisplay((50, 25), 150, (-96, 0), (.1, .9, .3)) self.mic_graph = GraphDisplay((110, 25), 150, 300, (-96, 0), (.1, .9, .3)) self.pitch_meter = MeterDisplay((50, 200), 150, (30, 90), (.9, .1, .3)) self.pitch_graph = GraphDisplay((110, 200), 150, 300, (30, 90), (.9, .1, .3)) self.canvas.add(self.mic_meter) self.canvas.add(self.mic_graph) self.canvas.add(self.pitch_meter) self.canvas.add(self.pitch_graph) # Record button self.record_button = InteractiveImage() self.record_button.source = "../data/mic.png" self.record_button.x = 400 self.record_button.y = 400 self.record_button.size = (100, 100) self.record_button.set_callback(self.init_recording) self.add_widget(self.record_button) # Play button self.play_button = InteractiveImage() self.play_button.source = "../data/play.png" self.play_button.x = 600 self.play_button.y = 400 self.play_button.size = (100, 100) self.play_button.set_callback(self.play_recording) self.add_widget(self.play_button) self.canvas.add(self.anim_group) self.onset_disp = None self.onset_x = 0 self.cur_pitch = 0 # Note Scheduler self.synth = Synth('../data/FluidR3_GM.sf2') # create TempoMap, AudioScheduler self.tempo_map = SimpleTempoMap(120) self.sched = AudioScheduler(self.tempo_map) # connect scheduler into audio system self.mixer.add(self.sched) self.sched.set_generator(self.synth) # Note Sequencers self.seq = [] # live Generator self.live_wave = None