MCPcopy Create free account
hub / github.com/bspaans/python-mingus / play_note

Function play_note

mingus_examples/pygame-drum/pygame-drum.py:88–115  ·  view source on GitHub ↗

play_note determines which pad was 'hit' and send the play request to fluidsynth

(note)

Source from the content-addressed store, hash-verified

86
87
88def play_note(note):
89 """play_note determines which pad was 'hit' and send the
90 play request to fluidsynth"""
91
92 index = None
93 if note == Note("B", 2):
94 index = 0
95 elif note == Note("A", 2):
96 index = 1
97 elif note == Note("G", 2):
98 index = 2
99 elif note == Note("E", 2):
100 index = 3
101 elif note == Note("C", 2):
102 index = 4
103 elif note == Note("A", 3):
104 index = 5
105 elif note == Note("B", 3):
106 index = 6
107 elif note == Note("A#", 2):
108 index = 7
109 elif note == Note("G#", 2):
110 index = 8
111 if index != None and status == "record":
112 playing.append([index, tick])
113 recorded.append([index, tick, note])
114 recorded_buffer.append([index, tick])
115 fluidsynth.play_Note(note, 9, 100)
116
117
118tick = 0.0

Callers 1

pygame-drum.pyFile · 0.70

Calls 2

NoteClass · 0.85
play_NoteMethod · 0.45

Tested by

no test coverage detected