From b618c4a6b74a52f830ca53029e1cc680d56a2501 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 6 Jul 2019 17:25:12 +0200 Subject: Implement Lua backend --- configs/demo.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 configs/demo.lua (limited to 'configs/demo.lua') diff --git a/configs/demo.lua b/configs/demo.lua new file mode 100644 index 0000000..e816ac4 --- /dev/null +++ b/configs/demo.lua @@ -0,0 +1,21 @@ +-- This example MIDIMonstaer Lua script spreads one input channel onto multiple output +-- channels using a polynomial function evaluated at multiple points. This effect can +-- be visualized e.g. with martrix (https://github.com/cbdevnet/martrix). + +-- This is just a demonstration of global variables +foo = 0 + +-- The polynomial to evaluate +function polynomial(offset, x) + return math.exp(-20 * (x - offset) ^ 2) +end + +-- Handler function for the input channel +function input(value) + foo = foo + 1 + print("input at ", value, foo) + + for chan=0,10 do + output("out" .. chan, polynomial(value, (1 / 10) * chan)) + end +end -- cgit v1.2.3