-
Notifications
You must be signed in to change notification settings - Fork 0
/
apc-akai.py
39 lines (34 loc) · 906 Bytes
/
apc-akai.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
import mido
import sys
#msg = mido.Message('note_on', note=60)
#msg.type
#msg.note
#msg.bytes()
#try:
# instr = sys.argv[2]
#except IndexError:
# instr = 1
pitch=0
mid = mido.MidiFile(str(sys.argv[1]))
with mido.open_input('Akai APC40:Akai APC40 MIDI 1 20:0') as inport:
for msg in inport:
if msg.channel == 0 and msg.note == 53 and msg.type=='note_on':
pitch=pitch+1
print (msg)
print(pitch)
if msg.channel == 0 and msg.note == 54 and msg.type=='note_on':
pitch=pitch-1
print (msg)
print(pitch)
#msg2.note=msg2.note+pitch
for msg2 in mid.play():
print(msg2.note)
#for msg in mid.play():
# msg.channel=0
# if msg.type == 'program_change':
# msg.program=int(instr)-1
# if msg.type == 'control_change':
# continue
# print (msg)
# port.send(msg)