-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_synths.py
executable file
·92 lines (76 loc) · 2.44 KB
/
map_synths.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/python3
"""
- Midi message routing
- CC to NRPN conversion for Roland M-xx1 soundmodules
- CC mapping, sustain for Volca FM
- Sustain for Circuit
- Note to PC mapping fur Circuit drums
"""
#--- mididings preliminaries
from mididings import *
from mididings.extra.inotify import AutoRestart
hook(
AutoRestart(modules=True)
)
#--- port definitions
inports = [('in_map_synths',)] # add virtual input port
outports= [
('to_SE1', 'MIDI4x4:2'),
('to_OC1', 'MIDI4x4:2'), # midi daisy chained
('to_VOLCA','MIDI4x4:3'), # midi daisy chained to Neutron
('to_NEUTRON','MIDI4x4:3'),
('to_CIRCUIT','Circuit:0'),
]
config(
client_name='map_synths',
backend='alsa',
in_ports=inports,
out_ports= outports,
start_delay=0.5
)
#-- Define channelnumbers for filter
Ch_CIRCUITDR = 10 # drums
Ch_CIRCUIT1 = 11 # synth 1, will be mapped to ch=1
Ch_CIRCUIT2 = 12 # synth 2, will be mapped to ch=2
Ch_SE1 = 13
Ch_OC1 = 14
Ch_VOLCA = 15
Ch_NEUTRON = 16
#-- Output-patches
from CC2NRPN import * # output converter for Roland Soundexpansions
from EV2VOLCAFM109 import * # output converter for Volca FM
from CircuitDrums import * # defines NOTE2DRUM
CC_Vol = 7
CC_Pan = 10
CC_Hold = 64
outp_CIRCUIT1 = [
CtrlFilter(CC_Vol) >> CtrlMap(CC_Vol, 12) >> Output('to_CIRCUIT',16),
CtrlFilter(CC_Pan) >> CtrlMap(CC_Pan, 117) >> Output('to_CIRCUIT',16),
PedalToNoteoff(ctrl=CC_Hold) >> Output('to_CIRCUIT',1) # Fake Sustain
]
outp_CIRCUIT2 = [
CtrlFilter(CC_Vol) >> CtrlMap(CC_Vol, 14) >> Output('to_CIRCUIT',16),
CtrlFilter(CC_Pan) >> CtrlMap(CC_Pan, 118) >> Output('to_CIRCUIT',16),
PedalToNoteoff(ctrl=CC_Hold) >> Output('to_CIRCUIT',2) # Fake Sustain
]
outp_CIRCUITDR = NOTE2DRUM >> Output('to_CIRCUIT',10) # Drum/Sample channel
outp_SE1 = CC2NRPN >> Output('to_SE1',1)
outp_OC1 = CC2NRPN >> Output('to_OC1',2)
outp_VOLCAFM = EV2VOLCAFM109 >> Output('to_VOLCA',1)
outp_NEUTRON = Output('to_NEUTRON',2)
#-- Main patch
run([
ChannelSplit({
Ch_CIRCUIT1: outp_CIRCUIT1,
Ch_CIRCUIT2: outp_CIRCUIT2,
Ch_CIRCUITDR: outp_CIRCUITDR,
Ch_SE1: outp_SE1,
Ch_OC1: outp_OC1,
Ch_VOLCA: outp_VOLCAFM,
Ch_NEUTRON: outp_NEUTRON,
}),
Filter(SYSRT_CLOCK) >> [outp_VOLCAFM, outp_NEUTRON, outp_CIRCUITDR], # midi clock events, runs permanent
Filter(SYSRT_START, SYSRT_CONTINUE, SYSRT_STOP) >> [outp_CIRCUITDR], # sync start/stop to FA-sequencer
Filter(SYSCM_SONGPOS) >> [outp_CIRCUITDR], # sync songposition
]
)