Issue running a user compiled RNBO patch on a Raspberry Pi 4
Hi, I compiled a simple test patch. Is just a phasor object connected to the output and also a buffer playing a short wav file. The patch works fine on the PC where I wrote it, and also works well if I export it from the RNBO app on the PC directly to the Pi.
I wanted to change the source code and then compile it directly on the Pi, I haven't changed the source yet as I just wanted to test the compilation process. I used the github template and compiled the patch in the Raspberry Pi but when I run the resulting program, the audio drops constantly. I tried setting the priority to the highest and even changing permissions to run in realtime ( chrt -f 99) but the problem persists. I'm also curious how the rnbooscquery is able to run in priority level 20 while running without drops, with patches that have much more complexity. Are there some compilation flags I'm missing for the Pi? or considerations on how to run the process?
I assume you mean the JUCE template on github?
One thing to note with that is that by default it builds a DEBUG executable. you can change that by setting -DCMAKE_BUILD_TYPE=Release
on the command-line OR, if you're using an interactive cmake frontend, set it there.
Hi Alex! Thanks for the quick response, yes I meant the JUCE template, is there any other one? I know RNBO has some JUCE headers so I assumed this one was the correct one. And yes I saw the resulting file is in the Debug folder, I'll try this change and report. Many thanks.
Unfortunately, building the patch again for Release instead of Debug results in the same behavior. I see the rnbooscquery service has some parameters to run. I've also tried to run my own compiled patch as a service using these parameters and the result is still dropping audio.
Type=idle
ExecStart=/home/pi/my_rnbo_self_compiled_patch
KillSignal=SIGINT
User=pi
Group=audio
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
Environment="JACK_NO_AUDIO_RESERVATION=1"
Restart=on-failure
RestartSec=5s
Lastly, I assume using the RNBO app, the source code is compiled locally on the pi, I see there is some .so library files such as libRNBORunnerSO1728919617.1.3.2.so inside the rnbo folder, and also the source files, but is not really clear what cmake configuration is being used to link to these libraries or how rnboooscquery is compiling the source. I assume is rnbooscquery and not the other two services but please let my know if my understanding is wrong. Are there any resources to follow and achieve a user compiled version of the C++ export that can run with the same performance as the RNBO to Pi export?
Many thanks in advance
Here is the source code for the runner (rnbooscquery). This builds the shared objects and loads them into a running application. The Max target sidebar code can either tell the runner to compile locally or do a cloud build and send over a compiled .so, but the details of the build are essentially the same.
I don't know of any more low level templates available for integrating RNBO. I'm curious, are you still running rnbooscquery when you test out your service?
Oh the source code for rnbooscquery will be really helpful, I did not realize it was available, thanks! And no, I stopped the service before testing my own compiled patch, to make sure there was just one audio app running. This is on the latest image you guys released for the Pi, I guess the JUCE template does something different on the sampling rate or the latency, because the default JUCE examples app also show the same drop in audio on the Pi. The CPU usage of that process was around 15% but the audio kept dropping.
I'll take it from here again with the rnbooscquery code. Many thanks for the quick responses Alex.
Another thing to consider is the audio interface are you using on the pi. The headphone out is notoriously finicky, IIRC I needed to set the buffer size to 512 or larger for it to work and when using jack, I had to explicitly indicate that there were no audio inputs.
Anyways, let us know what you come up with!
Oh we're using a WM8960, we've actually ran some decently elaborate patches using the RNBO to Pi export (drum machine + synth + recorder looper) and it works really well. I just wanted to expand on some functions that are more graphical and wanted to customize the code. Thanks for the suggestions and I'll keep you posted of course !