RT Jam
By Rosemary Hattersley. Posted
Engineer and Linux enthusiast Mike Vargo was exploring options for how to set up real-time music jams with his friends when fellow musician Darius Mostowfi introduced him to Raspberry Pi. He’d already tried out several hardware and software options, but once Mike realised that Raspberry Pi OS was simply a Debian distro, things slotted into place and RT Jam began to take shape.
Program a robot arm, with Raspberry Pi and Python code
“I was familiar with Voice over IP (VoIP) from previous experience and decided to try to build something with latency low enough to allow you to play as a group online,” says Mike. “When I saw that Raspberry Pi OS was just another Debian distro, I realised my laptop Linux code would compile and run on the Pi.”
Low latency
To work properly, RT Jam would need a person-to-person latency of less than 25 milliseconds. “I was leery of a peer-to-peer product because of the many issues with network firewalls, so I decided to opt for a client/server type structure,” Mike explains. However, “large variances” in sound, the input-output performance on Linux, Windows, and macOS made a software-only solution “very troublesome”, he says. “Raspberry Pi gave me a turnkey solution.”

Mike realised his 4GB Raspberry Pi 4 could be also used to run the broadcast server, including NGINX, and applauds the ability to install so many standard packages so easily. “Compiling the code on Raspberry Pi was very straightforward.”
Sound and vision
Before he began working on RT Jam – he describes the “want level” as a silver lining born of necessity – Mike had tried out Raspberry Pi for a putative HearSee project (also on GitHub) in which ultrasonic range sensors on a handheld stick convert distance readings into a sound form that would allow you to ‘see’ with your ears. That project is on hold, but it acted as an excellent demonstration of Raspberry Pi sensors’ capabilities. “Raspberry Pi worked great for hooking up the sensors and creating the sound,” he says. However, low-latency audio would work with Raspberry Pi only when using a USB 2.0 device for both input and output. He chose a FocusRite Scarlett controller, which he loves for its aesthetics as well as its performance.

Mike began by using DISTRHO/DPF, a software framework for audio plug-ins, using which he was able to program all the audio I/O via jack. He had help from falkTX who had been working on this framework for some time.
The design for the VoIP elements was Mike’s own. “I have done this kind of stuff before, so it was not too hard,” he says, “but I had not written any C++ code for 20 years, so I was a bit rusty. I’m sure if somebody looks at the code (it’s open-sourced), they will find lots of things to laugh at!”
"Once Mike realised that Raspberry Pi OS was simply a Debian distro, things slotted into place and RT Jam began to take shape."
One of the challenges was to get Raspberry Pi’s touchscreen working right and to figure out the settings for real-time audio. Once he was happy with everything, Mike simply copied it all as a microSD image.
He’s keen to develop RT Jam, adding capacity for more musicians to jam along. “I also want to hook up an Icecast feed from the server so even people who don’t have the software can just listen to a live broadcast of the room feed.”
Rosie has worked for consumer tech titles such as PC Advisor, Computeractive, CNET and Macworld and written For Dummies books on using iPads, Androids and tablets
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Programming station
Spot the microcontroller: we can see an Arduino Uno, Arduino Nano, a pair of ESP32 boards, and a Raspberry Pi Pico, all waiting to be played with.
Read more →
Solder fume extractor
This device has adjustable fan speeds and light levels, courtesy of Raspberry Pi Pico.
Read more →
Program a robot arm in Raspberry Pi Official Magazine 162
Worried about hackers stealing your zeroes and ones? How about transmitting data over an air-gapped pair of Raspberry Pi computers, so that information can go one way but not the other? The maker of this system is calling it a data diode, and you can ead all about it in this issue. If you’ve a […]
Read more →