Hi, I want to program an effect application (Stereo In -> FX -> Stereo Out). I want to use it live on stage, so I’m looking for low-latency solutions (<5ms). I want to control it via MIDI, no GUI required for now. In fact, I like to use the Raspberry Pi headless, no X server being present.
What’s the best way to go regarding software libraries? Should I write an ALSA application? Or base my stuff on JACK? Or write an lv2 plugin and find a host that works headlessly? I’d like to keep things as simple as possible, so I can focus on the actual code.
An ideal solution would give me a few callback functions for audio in->out, midi events, and that’s it I’ve written a lot of C/C++ code in the past, but only a little in audio, e.g., some C-objects for Max/MSP, MIDI processing on a Teensy and stuff like that, but nothing for the Linux audio stack.
Thanks for any help!
Using Jack would give a lot of opportunities for inter-operation with other audio software, and LV2 plugin might be the most universal option.
ALSA usually wants to have exclusive access to audio hardware, so it’s not very convenient.
Check out MODEP for hosting LV2 plugins, here’s a simple plugin example that could get you started: https://github.com/x42/tinyamp.lv2 - it simply adjusts the volume of the audio signal coming through the plugin.
You may find source code for every plugin included in MODEP, see modep-gen stages 4-5 to see how each of the plugin suite gets built.
This is exactly what I do for my live performance rig: I have a stereo effects chain implemented in SuperCollider, and controlled by a MIDI controller. I use the RPi headless.
I run the following effects chain (all effects in stereo):
- 2 DJ “sweep” style filters (HP & LP)
- Tempo locked gate
- 3 parallel, tempo locked delay lines (with feedback)
- 3 band, shelving parametric EQ
- mixing controls over dry, wet, delays, and reverb
You can find my code here: https://github.com/mzero/crunch-clockwise
That repo has my MIDI routing library for SuperCollider. The example file,
pbj.scd, is the very file I run live on stage. You are free to use it, or just follow it as a template.
I’m running with a block size of 64 samples - and there are three (four?) blocks between input and output. At 48kHz, thats just about 5ms!
Thanks a lot, that’s very interesting, I’ll take a look at the code!
There seems to be a significant part of the code related to GUI stuff, I wonder if it works without GUI as well…
LV2 plugins without GUI or with GUI that is not supported by MOD UI still work, the parameters of such plugins are then available in its settings sub-menu.
Btw, if you’d like your plugin to have a compatible GUI, see this repository: https://github.com/moddevices/mod-sdk