aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-06-27 16:45:35 +0200
committercbdev <cb@cbcdn.com>2021-06-27 16:45:35 +0200
commita92c6fb9f20ae26335b2ea3bd4539dd6e4aec256 (patch)
tree810f91a286409208147bf10b0701651d3b4858b1
parent011be343cd1427a1be68f9a0da38401b89de0fec (diff)
downloadmidimonster-a92c6fb9f20ae26335b2ea3bd4539dd6e4aec256.tar.gz
midimonster-a92c6fb9f20ae26335b2ea3bd4539dd6e4aec256.tar.bz2
midimonster-a92c6fb9f20ae26335b2ea3bd4539dd6e4aec256.zip
Add a python/lua example configuration
-rw-r--r--configs/pyexample.py8
-rw-r--r--configs/scripting-example.cfg22
2 files changed, 30 insertions, 0 deletions
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/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