diff options
Diffstat (limited to 'configs')
-rw-r--r-- | configs/launchctl-sacn.cfg | 3 | ||||
-rw-r--r-- | configs/midi-gamepad.cfg | 25 | ||||
-rw-r--r-- | configs/pyexample.py | 8 | ||||
-rw-r--r-- | configs/returnone.lua | 24 | ||||
-rw-r--r-- | configs/scripting-example.cfg | 22 | ||||
-rw-r--r-- | configs/trackpad.lua | 59 | ||||
-rw-r--r-- | configs/visca.cfg | 34 |
7 files changed, 174 insertions, 1 deletions
diff --git a/configs/launchctl-sacn.cfg b/configs/launchctl-sacn.cfg index 10a736a..612ac25 100644 --- a/configs/launchctl-sacn.cfg +++ b/configs/launchctl-sacn.cfg @@ -7,7 +7,8 @@ name = MIDIMonster [backend sacn] -bind = 0.0.0.0 5568 local +bind = 0.0.0.0 5568 +detect = verbose [midi lc] read = Launch Control diff --git a/configs/midi-gamepad.cfg b/configs/midi-gamepad.cfg new file mode 100644 index 0000000..f91ed4f --- /dev/null +++ b/configs/midi-gamepad.cfg @@ -0,0 +1,25 @@ +; Play games using a MIDI controller! See https://kb.midimonster.net/usecases/DolphinController.html +; This configuration will create a new input device (a joystick), which is controlled by a MIDI input. +; It could, for example, be used to play games in an emulator. +; This will only work on Linux. + +; This evdev instance will provide the new joystick device +[evdev controller] +; Set up the axis constraints - see the evdev backend documentation for what the parameters mean +axis.ABS_X = 34300 0 65536 255 4095 +axis.ABS_Y = 34300 0 65536 255 4095 +relaxis.REL_X = 65535 +; Set the output device name and enable the instance for output +output = MIDIMonster + +; This midi instance will be used as input to control the new joystick +[midi lc] +read = Launch Control + +[map] +; Use two CC's/rotaries to control the main joystick +lc.ch0.cc0 > controller.EV_ABS.ABS_X +lc.ch0.cc1 > controller.EV_ABS.ABS_Y +; Use two buttons to control the joystick buttons +lc.ch0.note0 > controller.EV_KEY.BTN_A +lc.ch0.note1 > controller.EV_KEY.BTN_B diff --git a/configs/pyexample.py b/configs/pyexample.py new file mode 100644 index 0000000..7213005 --- /dev/null +++ b/configs/pyexample.py @@ -0,0 +1,8 @@ +# Import the MIDIMonster Python API +import midimonster + +def channel1(value): + # Print current input value + print("Python channel 1 is at %s" % (value,)) + # Send inverse on py1.out1 + midimonster.output("out1", 1.0 - value) diff --git a/configs/returnone.lua b/configs/returnone.lua new file mode 100644 index 0000000..cde0b03 --- /dev/null +++ b/configs/returnone.lua @@ -0,0 +1,24 @@ +-- ReturnOne by Paul Hedderly +-- Sometimes you just want an on/off from linear pads +-- For example I want to activate scenes in OBS from a Korg NanoPad2 +-- But I dont want to have to thump the pads to get a 1.0 output +-- +-- You could use this as: +-- [midi nanoP] +-- read = nanoPAD2 +-- write = nanoPAD2 +-- [lua trackpad] +-- script = trackpad.lua +-- default-handler = returnone +-- .. +-- nanoP.ch0.note{36..51} > returnone.one{1..16} -- To feed all the 16 pads to +-- returnone.outone1 > obs./obs/scene/1/preview +-- returnone.outone2 > obs./obs/scene/2/preview +-- etc +-- The output channel will be the same as the channel you feed prepended "out" + + +function returnone(v) -- Use a default function - then you can use any input channel name + if v>0 then output("out"..input_channel(),1) end; + if v==0 then output("out"..input_channel(),0) end; +end diff --git a/configs/scripting-example.cfg b/configs/scripting-example.cfg new file mode 100644 index 0000000..fb9d6ca --- /dev/null +++ b/configs/scripting-example.cfg @@ -0,0 +1,22 @@ +; Turn on debugging to see what is coming in +[backend osc] +detect = on + +[python py1] +; This will load the pyexample.py script into this instance +module = pyexample + +[lua lua1] +; This will load the print.lua script into this instance +script = print.lua +; This will send all mapped channels to the `printchannel` function in there +default-handler = printchannel + +[osc in] +; Listen on port 8000 and send answers on port 9000 +bind = 0.0.0.0 8000 +dest = learn@9000 + +[map] +in./1/fader1 > py1.pyexample.channel1 +py1.out1 > lua1.lua-input diff --git a/configs/trackpad.lua b/configs/trackpad.lua new file mode 100644 index 0000000..0aa9de7 --- /dev/null +++ b/configs/trackpad.lua @@ -0,0 +1,59 @@ +-- Trackpad input by Paul Hedderly +-- Expects three sources X, Y and touch +-- On the Korg Nanopad2 these would be nanoP.ch0.cc1, nanoP.ch0.cc2, nanoP.ch0.cc16 +-- so you could map and feed this script with something like: +-- [midi nanoP] +-- read = nanoPAD2 +-- write = nanoPAD2 +-- [lua trackpad] +-- script = trackpad.lua +-- .. +-- nanoP.ch0.cc1 > trackpad.x +-- nanoP.ch0.cc2 > trackpad.y +-- nanoP.ch0.cc16 > trackpad.touch +-- +-- Each touch will generate four outputs +-- - on[1-9] - the first point of touch (might not be very useful!) +-- - off[1-9] - the final point of touch +-- - swipe[1-9][1-9] - the first and last as a *simple* gesture or swipe +-- - gesture[1-9]..[1-9] - every segment you touch in order so you can do complicated gestures +-- +-- Each output of 1 is followed by an output of 0 +-- You would map these as +-- trackpad.on3 > ... +-- trackpad.off9 > .... +-- trackpad.swipe17 > .... -- would catch a line from top left to bottom left but could go anywhere in between +-- trackpad.gesture78965 > .... would catch a backwards capital L starting at the bottom left + +-- -- Reserve state variables +contact=0; +trace=""; +x=0; y=0 +lpos="" + +function x(v) -- NOTE the code assumes that we get an X before the Y - Some devices might differ! + x=math.floor((v+0.09)*2.55) +end + +function y(v) + y=2-math.floor((v+0.09)*2.55) -- 2- so that we have 1 at the top + pos=""..x+1+y*3 -- we need a string to compare + lpos=string.sub(trace,-1) + print("pos"..pos.." lpos"..lpos.." = "..trace) + if pos ~= lpos then trace=trace..pos end +end + +function touch(v) + -- print("TOUCH .."..contact..".... trace"..trace) + if v==1 then contact=1 + elseif v==0 then + first=string.sub(trace,1,1); last=string.sub(trace,-1) + ends=first..last + output("on"..last,1); output ("on"..last,0) + output("off"..last,1); output ("off"..last,0) + output("swipe"..ends,1); output ("swipe"..ends,0) + output("gesture"..trace,1); output ("gesture"..trace,0) + print("TRACKPAD>>>"..trace.." ends.."..ends) + trace="" -- reset tracking + end; +end diff --git a/configs/visca.cfg b/configs/visca.cfg new file mode 100644 index 0000000..ac4b7a3 --- /dev/null +++ b/configs/visca.cfg @@ -0,0 +1,34 @@ +; This configuration controls a simple VISCA-capable Pan/Tilt/Zoom (PTZ) +; camera over the network via OSC (For example the "Mix 16" layout shipped +; with TouchOSC). + +[backend osc] +; Turn on the detect option to see what comes in +detect = on + +[visca cam] +; This is where we can reach the camera control server +connect = 10.23.23.127 5678 + +[osc touch] +; Bind a local OSC server to which TouchOSC will connect +bind = 0.0.0.0 8000 + +[map] +; Map the XY-pad to camera pan and tilt +touch./1/xy > cam.tilt +touch./1/xy:1 > cam.pan + +; Map control speeds +touch./1/fader1 > cam.panspeed +touch./1/fader2 > cam.tiltspeed + +; Map zoom to a fader +touch./1/fader4 > cam.zoom + +; Map some presets +touch./1/push1 > cam.home +touch./1/push2 > cam.memory1 +touch./1/push3 > cam.memory2 +touch./1/push4 > cam.store1 +touch./1/push5 > cam.store2 |