Last active
April 9, 2017 18:31
-
-
Save mxmilkiib/cf755232b3631e5fe68af1be5e1066cc to your computer and use it in GitHub Desktop.
m_control.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# m_control.py - mididings nano control switcheroo | |
from mididings import * | |
# for toggling cc state | |
from mididings.event import * | |
# auto restart - doesn't work - loads "mididings-01" client if not manually restarted | |
# from mididings.extra.inotify import AutoRestart | |
# for livedings | |
from mididings.extra.osc import OSCInterface | |
hook( | |
OSCInterface(port=56800, notify_ports=[56801]) | |
# AutoRestart() | |
) | |
config( | |
backend='jack-rt', | |
client_name='mididings-control', | |
in_ports=['djx', 'nano', 'seq64drumsR', 'control'], | |
out_ports=['notes', 'seq64drumsS', 'nanoC', 'nanoOutM', 'nanoOutT'] | |
) | |
# control patch | |
# control runs in parallel with the current scene patches | |
control = [ # Filter all but program changes on channel 16 for scene switching | |
PortFilter('control') >> [ # earlier nano to program change up/down | |
Filter(PROGRAM) >> SceneSwitch (), | |
# fn 1 - turn on ersdrums send | |
Channel(16) >> CtrlFilter(38) >> CtrlValueFilter(lower=2) >> SceneSwitch(1) ], | |
PortFilter('nano') >> [ # Always send nano to nanoC output | |
CtrlMap(0, 8) >> CtrlMap(32 ,40) >> Port('nanoC'), | |
# scene change - nano < and > | |
CtrlFilter(58) >> CtrlValueFilter(127) >> SceneSwitch(offset=-1), | |
CtrlFilter(59) >> CtrlValueFilter(127) >> SceneSwitch(offset=1), | |
CtrlFilter(46) >> CtrlValueFilter(127) >> SubSceneSwitch(offset=1,wrap=True) ]] | |
djx_fix = Port('djx') >> ~Filter(SYSRT) | |
# Carla reserves cc#0 and cc#32 for program changes | |
nano_fix = Port('nano') >> CtrlMap(0, 8) >> CtrlMap(32, 40) | |
# split keyboard at c5: bottom part to notes output port, top part transposed down to 36 (c2) and sent to channel 10 on drums output port | |
djx_drumsplit = KeySplit('f4', Port('notes'), Transpose(-41) >> Channel(10)) | |
# pre scene patch | |
# before all scenes, doesn't affect control patch | |
# | |
scene_1 = [ PortFilter('nano') >> nano_fix >> Output('nanoOutM', 1), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit >> Port('seq64drumsS') ] | |
# | |
scene_1b = [ PortFilter('nano') >> nano_fix >> CtrlFilter(8, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22) % (Output('nanoOutM', 1), Output('nanoOutT', 1)), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit >> Port('seq64drumsS') ] | |
# | |
scene_2 = [ PortFilter('nano') >> nano_fix >> Output('nanoOutM', 2), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit ] | |
scene_2b = [ PortFilter('nano') >> nano_fix >> nano_fix >> CtrlFilter(8, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22) % Output('nanoOutM', 2) >> Output('nanoOutT', 2), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit ] | |
# | |
scene_3 = [ PortFilter('nano') >> nano_fix >> Output('nanoOutM', 3), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit ] | |
scene_3b = [ PortFilter('nano') >> nano_fix >> CtrlFilter(8, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22) % Output('nanoOutM', 3) >> Output('nanoOutT', 3), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit ] | |
scene_4 = [ PortFilter('nano') >> nano_fix >> Port('nanoOutM'), | |
PortFilter('djx') >> djx_fix >> djx_drumsplit >> Port('seq64drumsS') ] | |
scenes = { | |
1: SceneGroup("nano delays", [ | |
Scene("momentary", scene_1), | |
Scene("toggle", scene_1b) ]), | |
2: SceneGroup("nano gates", [ | |
Scene("momentary", scene_2), | |
Scene("toggle", scene_2b) ]), | |
3: SceneGroup("nano misc fx", [ | |
Scene("momentary", scene_3), | |
Scene("toggle", scene_3b) ]), | |
4: Scene("nano levels", scene_4) | |
} | |
run( | |
control=control, | |
# pre=pre, | |
scenes=scenes | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment