Beispiel #1
0
 def pressed(self, event, note, octave, released=False):
     if self.arpeggio_playing:
         if not released:
             # arp still playing... stop it
             self.arpeggio_playing = False
         return
     a4freq = self.a4_choice.get()
     if self.arp_filter.input_mode.get().startswith("arp"):
         if released:
             self._pressed([0, 1, 2], released=True)
             return
         chord_keys = major_chord_keys(note, octave)
         if self.arp_filter.input_mode.get() == "arpeggio3":
             chord_keys = list(chord_keys)[:-1]
         chord_freqs = [note_freq(note, octave, a4freq) for note, octave in chord_keys]
         self.statusbar["text"] = "arpeggio: "+" ".join(note for note, octave in chord_keys)
         self.arpeggio_playing = True
         self._pressed(chord_freqs)
     else:
         self.statusbar["text"] = "ok"
         a4freq = self.a4_choice.get()
         freq = note_freq(note, octave, a4freq)
         self.current_note = (note, octave, freq)
         self._pressed(freq, released)
Beispiel #2
0
 def pressed(self, event, note, octave, released=False):
     if self.arpeggio_playing:
         if not released:
             # arp still playing... stop it
             self.arpeggio_playing = False
         return
     a4freq = self.a4_choice.get()
     if self.arp_filter.input_mode.get().startswith("arp"):
         if released:
             self._pressed([0, 1, 2], released=True)
             return
         chord_keys = major_chord_keys(note, octave)
         if self.arp_filter.input_mode.get() == "arpeggio3":
             chord_keys = list(chord_keys)[:-1]
         chord_freqs = [note_freq(note, octave, a4freq) for note, octave in chord_keys]
         self.statusbar["text"] = "arpeggio: "+" ".join(note for note, octave in chord_keys)
         self.arpeggio_playing = True
         self._pressed(chord_freqs)
     else:
         self.statusbar["text"] = "ok"
         a4freq = self.a4_choice.get()
         freq = note_freq(note, octave, a4freq)
         self.current_note = (note, octave, freq)
         self._pressed(freq, released)
Beispiel #3
0
 def create_chord_osc(clazz, **arguments):
     if is_audio and self.arp_filter.input_mode.get().startswith("chords"):
         chord_keys = major_chord_keys(self.current_note[0], self.current_note[1])
         if self.arp_filter.input_mode.get() == "chords3":
             chord_keys = list(chord_keys)[:-1]
         a4freq = self.a4_choice.get()
         chord_freqs = [note_freq(note, octave, a4freq) for note, octave in chord_keys]
         self.statusbar["text"] = "major chord: "+" ".join(note for note, octave in chord_keys)
         oscillators = []
         arguments["amplitude"] /= len(chord_freqs)
         for f in chord_freqs:
             arguments["frequency"] = f
             oscillators.append(clazz(**arguments))
         return MixingFilter(*oscillators)
     else:
         # no chord (or an LFO instead of audio output oscillator), return one osc for only the given frequency
         return clazz(**arguments)
Beispiel #4
0
 def create_chord_osc(clazz, **arguments):
     if is_audio and self.arp_filter.input_mode.get().startswith("chords"):
         chord_keys = major_chord_keys(self.current_note[0], self.current_note[1])
         if self.arp_filter.input_mode.get() == "chords3":
             chord_keys = list(chord_keys)[:-1]
         a4freq = self.a4_choice.get()
         chord_freqs = [note_freq(note, octave, a4freq) for note, octave in chord_keys]
         self.statusbar["text"] = "major chord: "+" ".join(note for note, octave in chord_keys)
         oscillators = []
         arguments["amplitude"] /= len(chord_freqs)
         for f in chord_freqs:
             arguments["frequency"] = f
             oscillators.append(clazz(**arguments))
         return MixingFilter(*oscillators)
     else:
         # no chord (or an LFO instead of audio output oscillator), return one osc for only the given frequency
         return clazz(**arguments)