A low latency guitar effects processor suitable for running on a Raspberry Pi
github.com
github.com
That's a killer feature for me, hiding at the end of the README. I have a Fractal Audio FM3[0] at home, and the only way I edit my patches is using their editing software over a USB connection to the device. Adding the ability to program (and even control) my patches live over any wifi-enabled device is even cooler!
There's a small introduction video: https://www.youtube.com/watch?v=5USQ7BsZ054
And Modep (as @tcrenshaw wrote in another comment) this is a MOD emulator for Raspberry pi, just in case you want to play with it: https://blokas.io/modep/
But, incidentally, at my day job I'm working on an embedded Linux system where audio latency matters, and which may well wind up with a WiFi radio (where latency probably doesn't matter so much). So, I'd like to understand issues in this space.
The same isn't true for SD card access, which does cause dropouts. I've seen a video that suggests that disabling power management for the SD card hardware will correct the problem -- specifically that changing power state causes a 3ms delay. But I'm not quite sure how to go about disabling that on a Raspberry Pi OS.
. WiFi doesn't seem to affect audio latency. That's not true for Raspberry Pi 3, where WiFi and USB ports do run on the same USB hub.
Eg https://www.digi.com/products/networking/infrastructure-mana...
Open source version: https://monome.org/docs/norns/shield/
This is the thing that bums me out with DIY audio: people come up with extraordinary designs, do a limited run and then never (or rarely) make any more.
I never bought a milkymist. There are no more being produced. The design has never been updated for modern formats, such as hdmi. I have no clue how to design hardware.
If you ship parts, you can avoid it. If you ship it assembled, you'll need to spend tens of thousands of dollars getting it FCC certified.
It has audio in so needs no external usb sound hardware.
It also has a programmable button. A simple idea but very useful
For my use-case the touchscreen is entirely unnecessary (programming it via a WebUI sounds more convenient anyway if you don't need to use it sans PC), which is inflating t he BOM by about 500%, and of course RPi4 is a uniquely poor choice of target platform at this particular moment in time, so seeing if it can run on a headless Pi Zero is definitely going on my endless to-do list. ;)
Have a look at this example to see how easy using that library is : https://github.com/pschatzmann/arduino-audio-tools/blob/main...
1. I'd have a hard time seeing that small screen onstage, and my big foot would likely mash the wrong effects button. Others might find it easier.
2. There are tons of good, cheap effects boxes out there, and easy to find used. I like Pi boxes, but this seems like a homebrew replication of what's on the market.
3. All good boxes are low-latency, in my experience. It's a fundamental thing I think most players need.
The project is using a 7" (17.7cm) LCD display. The Line6 HX Stomp is very popular and has a 2.4" (6cm) LCD display.
I ended up using Teensy[1] and related audio shields[2] to get things working from a sound/acceptable delay perspective. But being able to get things going on a Pi would probably make more of the advanced input controls much simpler to implement simply from a OS support perspective (like in this project with the WebUI). The UI I'm seeing in this project looks great and it would be cool to potentially see something like kits/preinstalled images roll out for this!
[0] - https://www.electrosmash.com/pedal-pi [1] - https://www.pjrc.com/teensy/ [2] - http://blackaddr.com/products/
What's the latency? I can't find numbers anywhere.
What is the expected latency of those cheap usb devices?
I had one that was unusable live. Noticeable latency. Have they gotten better?
Applies to many things related to an advertised product. Things like price, quantity, material, country of origin, standards met, certifications, scores, etc.
The CPU tech is here today, and modern general purpose processors do a good job of handling low-latency audio. Someone just needs to put all that together in a unified and stable package...
Not so great when they aren't.
Processing, mostly true (though there are still some reverbs that can chew an awful lot of cycles).
Synthesis, however, is a different story. That is definitely CPU performance limited once you get into substantial numbers of voices/tracks/synths.
Wish I had seen the OP's project months ago, but one bonus of the setup I describe is the ability to swap effects after the fact (by virtue of having the dry signal) and the ability to automate effects (so I can engage distortion etc as soon as we hit measure XYZ instead of having to click a pedal)
However I was more thinking of mixers like the QSC Touchmix/X32/etc. where the DSP probably eats up quite a bit of the unit cost, and how the price could be significantly brought down if the innards merely contained analog I/O and converters all tying into a powerful SoC.
I've got some prototypes in C# that can draw a 1080p bitmap and encode to JPEG in under 10ms. Using single threading, socket mux servers and aggressive multimedia timers means my network delay is usually right at 1ms.
I feel like if you are just worried about audio, there is definitely enough bandwidth here to do what you need to per unit time.
In other words, 'realtime' audio processing needs to happen 1700x faster that 'realtime' image work. Bandwidth isn't limiting factor, deterministic and uniform latency is that challenge for any signal as the sample rate goes up.
The general consensus is that guitar effects have to have no more than 10ms latency.
That 10ms benchmark is a good one though. At that time window you've reached a full wavelength at 100Hz and it's right about the point where well practiced humans (e.g. musicians) will begin to perceive delay. It's a fascinating intersection between physics/engineering and psychology as signal latencies make the jump from being perceived as timbre to delay.
Harrison Consoles have done this for more than 10 years.
I cannot confirm this in the same way, but I think it also likely that both Lawo and Studer digital consoles do this, and also possibly Allen & Heath. All 4 companies run Linux internally on their consoles.
All of the vst plugins are CPU bound and even though i have a top of the line i7 and 32 gigs of ram, my computer slows to a crawl when editing even moderate sized songs.
Specifically, there is an nvidia bug that introduces latency to real time audio, making guitar and other live performance unplayable.
It really sucks! At least it has finally been ack'd (Increase in DPC latency observed in Latencymon [3952556]): https://us.download.nvidia.com/Windows/531.18/531.18-win11-w...
This has been a problem for YEARS. Hopefully they will finally fix it.
I mostly play guitar and don't notice the latency in most effect chains that I use.
It is extremely frustrating.
For those interested: a predecessor called the "Jesusonic" was once made by Justin Frankel (of Winamp and REAPER fame): https://www.cockos.com/jsfx/ https://wiki.cockos.com/wiki/index.php/Jesusonic_Documentati...
:)
https://raspberrypi.stackexchange.com/questions/71613/how-to...
The RtMidi library is probably your best bet for getting started. I found the ALSA library to suit my workflow a bit better, but the setup is pretty obtuse. RtMidi is much more user friendly in that regard.
Also, look into implementing the Ableton Link library. It runs over your network, and is honestly astounding how well it sync's devices.
The Odroid C4 you can actually get is an alternative with 4 USB ports and an OTG that is gadget capable. Unlike older models, mainline Linux support is decent.
I'm currently using an Elektron Digitakt to sequence my analog gear - it's great - but unfortunately the DT is limited to 8 MIDI tracks with only 1 LFO per MIDI track to automate MIDI CC data. I'd love a Cirklon Sequentix but the waitlist is just too long (3 years atm, arghh).
I wonder if I can hook up something like a Midiface 16x16 (https://miditech.de/en/portfolio/midiface-16x16/) to the RPi. The Midiface is Class Compliant so maybe the RPi can use it natively..(?) I'm a bit worried about performance though.
Thanks for your suggestions, I'm going to look into them!
https://www.reddit.com/r/raspberry_pi/comments/p0jkb3/guitar...
My particular use case is simply playing MP3s read from mmc through an MBox1 on USB.
No matter how much irqbalance, isolcpus, taskset magic, it never gets absolutely perfect. It gets better, but there's always spurious delays exhibited as occasional pops and clicks in the audio output.
I'm hopeful that [0] will improve the situation, but haven't had time to really dig into it let alone build a custom bleeding-edge mainline kernel - which I'm not even sure supports all the Pi4B hardware.
It's asinine that an otherwise idle 4Cx1.8Ghz machine can't even play MP3s on a USB MBox1 flawlessly with zero special effort...
[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
Can anyone comment about the relative processing power of a RPi vs the market solutions? Is the RPi theoretically good enough that a pedalboard could be completely modelled?
[0] Interestingly, it sounds like SHARC chips were designed to be low cost processors for single use applications in guided artillery shells.
And Wikipedia's page of all the RPi models says that the latest (4B) manages 8 GFLOPS at around 1.8 GHz.
If that means that the answer to your question is "yes" or "no" is unfortunately a lot harder to Google and/or figure out. I would assume that the SHARC-based devices run on the metal, whereas most applications for the Raspberry Pi run under Linux, for instance.
[1]: https://www.analog.com/en/products/adsp-21469.html#product-o...
[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#Simplified_Model_...
Edit: grammarish.
The real-time kernel provides additional improvements. But it's incredibly difficult to find up-to-date real-time kernels these days.
They will still have a CPU on devices like this, but all it does is run the UI, the sound processing is not done on a CPU.
So you have to make all your own effects in code? It would be cool if it connected to something like Guitarix (open source) so you could use existing guitar effects. (Disclaimer: I've never used Guitarix, so it might sound shit)
Btw, for anyone who doesn't play guitar, but is interested... Gone are the days of those huge pedal boards and having to buy 30 different pedals. Emulation is getting really really good. You can either buy a multi-effects pedal and use that onstage. Or if you're in the studio, NeuralDSP is software which can emulate basically any sound you're after. It's expensive though, but it sounds better than free alternatives like Amplitube.
I'd love to write about this soon. Kudos to the coder
I switched to BSD and got much better latency on the same hardware
But I think that was the alsa -> BSD oss driver swap, which is possible on linux too. I had just never tried it, since I assumed linux was best
(I'm only sharing this cus i think its interesting, and may help you get good latency)
Was anything I said wrong?
Seriously, I've spent a long time fixing up low latency audio
jackd + OSS on whatever OS u like is not bad advice fyi
Personally I'm very happy to see that info as I do use both Linux and *BSD and wouldn't have ever tried setting up BSD for audio until now.
Pipewire is supposed to offer low latency as well - at least lower than Pulseaudio, but I don't know how much.
A quick skim didn't turn up what audio backend this project is using, but I'm using patchbox with modep on my Pi4 as a bass pedal board and it's pretty much flawless low latency. I do need to add a fan to my pi since it's mounted underneath a pedal board and doesn't get quite enough air though.
Granted, this was in windows, but from what I understand there is always going to be some audible processing delay with a USB 2.0 interface.
(Convoluted reverb is utterly awesome but more processor intensive than almost anything else)
Edit: and sorry, to be helpful, by low latency, could you meantion how many ms that is -- because while I'm very happy for you, and really interested, 15ms is very different to say 5ms or lower
Convolution reverb is an option, but it ended up being a little more than the Pi4 could handle iirc. I didn't tinker with it much though.
Latency is under 10ms, I'd have to go back and check my settings to confirm exactly though.
A really helpful data point :)
--
You're doing great! You don't need my help, but just share my own path, because it's fun :)
Yeah, play the bass, if i start talking about computing im not helping...
Err, why am i still here?
I switched to BSD or the OSS driver and went from massive effort ~5ms to zero effort ~2ms
Then I made a two button controller and pedal->usb, and started programming an arbitrary effects controller: a looper + buttons to switch the pedal to control any fx parameter
Fun, but it didn't help me make better music :)
The UI, MODEP, is based on the Mod Devices work on their open source pedal (Originally Mod Duo) > https://mod.audio/.
which solves the problem with using a bar's Wi-Fi by using Wi-Fi Direct.
Stable audio at 3.9ms latency (measured using a loopback cable).
Hosting plug-ins is a very powerful way to go.
The low latency would refer to the latency of the audio input (guitar) being processed and producing a sound. Ideally you want no discernible delay between when you hit a string and when a sound is produced.
As for how much delay is considered "acceptable", I'm not going to open that can of worms...