Demo of Lua looping script

I’m not sure if this is the right category as it isn’t a complete song. I hacked together a Lua script that allows me to trigger midi loops in Ardour and this is a quick demo of it using a Launchpad.

That looks like some impressive Lua DSP script!
Could you elaborate how you made this work?

Cheers dude!

When the script is loaded it loads into a Lua table midi from any region with a name starting with “loop”, then based on a naming convention is assigns this midi to one of the Launchpad buttons, or failing this the loop will be available in a drop down for each of the 64 buttons so that it can be assigned manually. A midi channel is also assigned in a similar way.

In the dsp_runmap function it listens for the relevant midi-on data and then changes the state of a Lua table that keeps track of whether a channel/midi combination is due to come on/off at the start of the next bar. It also keeps a track of whether this combination is actually on or off. This same state is also read and there is logic that decides if any midi signals should be sent during this cycle based on some offset calculations.

There is also some code in here that sends midi back to the device in order to update the state of the buttons so that they flash when a loop is playing, flash slightly dimmer when a loop is due to come on, and go white when a loop is due to go off. Something similar is also displayed in the inline display.

There are three midi output ports: one is pass-through; one contains the midi notes to be played and this will have to be mapped to tracks using the midi routing, and the tracks will need to only play notes on the relevant channel; the final port contains the data for the Launchpad lights.

The script is here: https://github.com/Rob8000/LuaScriptsForArdour/blob/master/looper.lua. But it is somewhat hacky and quite a few things are hardcoded to work with the Launchpad. It also uses the C.ByteVector datatype which is only available in Ardour 6.0. It only works with single bars of four beats right now. I didn’t post a link to the script in the original post for these reasons :slight_smile:

1 Like