Exemplo n.º 1
0
 def play_chord(self, chord):
     """
     Chord should be an ordered iterable container of notes
     """
     if self.is_playing_chord(chord):
         self.stop_chord(chord)
     self.playing.append(set(chord))
     for note in chord:
         # TODO: timing & stopping note_on when chord already stopped
         midi.note_on(note, note_vel)
Exemplo n.º 2
0
 def play_note(self, note):
     if self.is_playing_note(note):
         self.stop_note(note)
     self.playing.append(set([note]))
     midi.note_on(note, note_vel)
Exemplo n.º 3
0
import time
import midipy as midi

midi.open(128, 0, "midipy test", 0)

for (note, t) in [(48,0.5),(48,0.5),(50,1.0),(48,1.0),(53,1.0),(52,1.0),
                    (48,0.5),(48,0.5),(50,1.0),(48,1.0),(55,1.0),(53,1.0)]:
    midi.note_on(note,127)
    time.sleep(t/2)
    midi.note_off(note,127)

midi.close()