• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

RPi + CamillaDSP Tutorial

You mean a websocket between the gui backend and the frontend? No that isn't available, and it's not something I'm planning to add. You can bypass the gui and talk to the DSP via websocket, but you will still need to poll the state.
Yes, my initial idea was to get the status of CDSP from the same source that where the GUI gets it (get /api/status). I could try the other api commands too if they are lighter and faster. I was building a PoC with Python that would run on the same RPi as CDSP and when it's in running state, it would raise one of the GPIO and pull it down when not running. So is there yet another api in form of a websocket that gives out status of the CDSP? Better yet, is there some other built in feature that would work better?

CDSP GUI process seems to consume more CPU power of my RPi Zero 2 than the actual DSP process, which is kind of funny, but it's usually under 7% so not a deal breaker.
This behavior comes from the USB gadget device. When no application uses the device, then windows closes it. This makes the capture side (where CamillaDSP is listening) immediately stop providing data. This is why it goes straight to stalled, the silence timeout doesn't matter here
Fair enough, though not optimal for a 12 V trigger signal. I could implement complementary hysteresis control in my poller though.

How long does it take? I run my own system with usb gadget on a RPi4, and it resumes pretty much instantly.
If you have used it, you can remember that the Windows test sound is 3 dings for left and then to right channel. I can hear last 1-1.5 dings from right channel. I think it takes more than 2 seconds to wake up from stalled state. As mentioned, paused state will resume to running instantly.

That delay could also be because some other unknown factor. I previously used RPi 4B with considerable underclocking and power saving when trying to run it on USB port power. But this Zero line runs with way less power (0.9 Watts when CDSP is RUNNING if memory serves), so I think that I never altered any of those settings on it. It could also be my computer, some kind of setting that I'm unaware of.
 
I am trying to redo everything and update to camilladsp 3.0+. Tried starting with a clean slate. Could not get Raspberry PI OS Lite working. I had issues connecting via ssh. Instead went with Ubuntu Server 25.04. I have everything working except for the OLED display. I get an error, I am not able to get past.

File "/home/dinesh/oled.py", line 37, in <module>
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: [B]chip = sbc.gpiochip_open(4)[/B]
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: File "/opt/venv/lib/python3.13/site-packages/lgpio.py", line 645, in gpiochip_open
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: return _u2i(handle)
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: File "/opt/venv/lib/python3.13/site-packages/lgpio.py", line 458, in _u2i
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: raise error(error_text(v))
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: [B]lgpio.error: 'can not open gpiochip'[/B]

The same piece of code runs in the old configuration where I had camilladsp 2.0+ and older Ubuntu os.

I have lgpio 0.2.2.0 installed. Any help is appreciated.
 
I am trying to redo everything and update to camilladsp 3.0+. Tried starting with a clean slate. Could not get Raspberry PI OS Lite working. I had issues connecting via ssh. Instead went with Ubuntu Server 25.04. I have everything working except for the OLED display. I get an error, I am not able to get past.

File "/home/dinesh/oled.py", line 37, in <module>
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: [B]chip = sbc.gpiochip_open(4)[/B]
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: File "/opt/venv/lib/python3.13/site-packages/lgpio.py", line 645, in gpiochip_open
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: return _u2i(handle)
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: File "/opt/venv/lib/python3.13/site-packages/lgpio.py", line 458, in _u2i
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: raise error(error_text(v))
Aug 12 16:19:53 pi5-cdsp3 oled[151317]: [B]lgpio.error: 'can not open gpiochip'[/B]

The same piece of code runs in the old configuration where I had camilladsp 2.0+ and older Ubuntu os.

I have lgpio 0.2.2.0 installed. Any help is appreciated.

What issue did you have with SSH? Did you enable it in Raspberry Pi imager? I think it would be better to get Raspberry Pi OS Lite working, especially if you are using the OLED display as performance will be much better than Ubuntu.

I do not like troubleshooting operating systems other than Raspberry Pi OS Lite, too many differences to keep track of. However, I did just run through an install with Ubuntu Server 25.04 and it was completely the same as Raspberry Pi OS, other than a few missing dependencies. You mention that you had previously used V2, did you successfully install the python virtual environment as described in the current tutorial (see code snippet below)? I did notice I needed to run "sudo python3" instead of "sudo python" with Ubuntu unless I installed the "python-is-python3" package.

Code:
sudo python -m venv --system-site-packages /opt/venv
source /opt/venv/bin/activate
pip3 install git+https://github.com/HEnquist/pycamilladsp.git
deactivate

Only other thing I can think of is my lgpio version is slightly different than yours. Did you install python3-lgpio? Or did you install through pip? You should install python3-lgpio.

Code:
apt search lgpio
python3-lgpio/plucky,now 0.2.0.0-0ubuntu4 arm64 [installed]
Control GPIO pins via gpiochip devices - python3 bindings

Michael
 
I'm thinking about adding a loudness filter to my pipeline which currently contains PEQ settings and a gain filter. Where in the pipeline should the loudness filter go? I listen a lot at low volumes so I think loudness would be a nice to have.
 
I'm away from my system till tomorrow and then I'll try it straight away. Thanks for the suggestion!
Thanks to everyone who helped me out. I now have a working three way digital crossover. Turns out my (under)power(ed) supply was the root of the issues! Moral of the story, have a 5A PS for the Rpi5.
 
I'm thinking about adding a loudness filter to my pipeline which currently contains PEQ settings and a gain filter. Where in the pipeline should the loudness filter go? I listen a lot at low volumes so I think loudness would be a nice to have.

Just my 2 cents but assuming two channel input I'd put it upstream of your mixer.

1755106424890.png


Michael
 
What issue did you have with SSH? Did you enable it in Raspberry Pi imager? I think it would be better to get Raspberry Pi OS Lite working, especially if you are using the OLED display as performance will be much better than Ubuntu.
Using the pi as a headless device, getting ssh to work was critical. I tried setting it up for password authentication, but would always default to the other keys based authentication, which I did not have. Another friend of mine also had a lot of issues with Raspberry PI OS and he gave up too, his problems were different, they were around alsa. I will ask him to report his issues here. Anyway, he went with an apple device instead.
I do not like troubleshooting operating systems other than Raspberry Pi OS Lite, too many differences to keep track of. However, I did just run through an install with Ubuntu Server 25.04 and it was completely the same as Raspberry Pi OS, other than a few missing dependencies. You mention that you had previously used V2, did you successfully install the python virtual environment as described in the current tutorial (see code snippet below)? I did notice I needed to run "sudo python3" instead of "sudo python" with Ubuntu unless I installed the "python-is-python3" package.
That was done a couple years back, I don't remember if I did install a virtual python env.
Code:
sudo python -m venv --system-site-packages /opt/venv
source /opt/venv/bin/activate
pip3 install git+https://github.com/HEnquist/pycamilladsp.git
deactivate

Only other thing I can think of is my lgpio version is slightly different than yours. Did you install python3-lgpio? Or did you install through pip? You should install python3-lgpio.

Code:
apt search lgpio
python3-lgpio/plucky,now 0.2.0.0-0ubuntu4 arm64 [installed]
Control GPIO pins via gpiochip devices - python3 bindings

Michael
It is still not working, this is what I have now.

apt search lgpio
liblgpio-dev/plucky,now 0.2.0.0-0ubuntu4 arm64 [installed]
Control GPIO pins via gpiochip devices - static libraries and headers
liblgpio1/plucky,now 0.2.0.0-0ubuntu4 arm64 [installed,automatic]
Control GPIO pins via gpiochip devices - shared libraries
python-rpi-lgpio-doc/plucky 0.6-0ubuntu1 all
Compatibility shim for lgpio emulating the RPi.GPIO API - docs
python3-lgpio/plucky,now 0.2.0.0-0ubuntu4 arm64 [installed]
Control GPIO pins via gpiochip devices - python3 bindings
python3-rpi-lgpio/plucky 0.6-0ubuntu1 all
Compatibility shim for lgpio emulating the RPi.GPIO API

BTW, if the oled performance on ubuntu was poor, I did not notice it in my old configuration.
 
Last edited:
I am not sure what else I can do to help you troubleshoot with the information provided.

If you haven't done an install in a while I strongly suggest you follow and read through the tutorial carefully. If you follow the steps it will work. There have also been a good number of changes, for example, the GPIO pin assignment has changed. If you are no longer getting errors in oled.service, but the display is not showing anything this is likely the reason.

Michael
 
Fair enough, though not optimal for a 12 V trigger signal. I could implement complementary hysteresis control in my poller though.
But there is no point in keeping the amp on when no sound is coming through. I cannot exactly remember how it worked before, but I feel like it STALLED, but woke up quickly. It's way slower to wake up now. I keep my amp on during the work day, but now I usually cannot hear short notice sounds, like when I receive direct message in Teams. I used to hear those before with the same devices and software. Maybe some update changed things. I wonder where to start debugging this...
 
@mdsimon2 restarted the effort, by installing Raspberry OS Lite 64 bit and enabling ssh after connecting a display and kbd. I am now getting a null from CamillaClient in flirc, perhaps need better exception handling?

flirc.service: Failed with result 'exit-code'.
flirc.service: Main process exited, code=exited, status=1/FAILURE
AttributeError: 'NoneType' object has no attribute 'split'
^^^^^^^^^^^^
configdir = active.split('camilladsp/configs/')[0] + 'camilladsp/configs/'
File "/home/dinesh/flirc.py", line 16, in <module>
 
Last edited:
I have ~ in /home/dinesh/camilladsp/statefile.yml
config_path: ~

and this in /lib/systemd/system/camilladsp.service

User=dinesh
WorkingDirectory=~
ExecStart=camilladsp -s camilladsp/statefile.yml -w -g-40 -o camilladsp/camilladsp.log -p 1234

Should I hard code the path to statefile.yml to:
ExecStart=camilladsp -s /home/dinesh/camilladsp/statefile.yml -w -g-40 -o camilladsp/camilladsp.log -p 1234
 
Please read and follow the tutorial, particularly step 9 which talks through applying a configuration in the GUI.

Your statefile.yml shows ~ for config_path because you have not yet applied a configuration.

Michael
Thanks a lot @mdsimon2 yes, I had not applied configuration. Now I have both the flirc and oled services appear to be running. I get no errors, but flirc doesnot seem to respond to the remote, nor do I see oled come on. I even inserted a small delay in these 2 services starting up. Thought camilladsp starting up might be an issue, but that delay did nothing. I guess I am still missing some configuration details, maybe flirc and/or oled is unable to talk to camilladsp?.
 
Does anyone know why there are so many lost connections in the log?
2025-08-20 20:14:46.319500 INFO [src/bin.rs:781] CamillaDSP version 3.0.1
2025-08-20 20:14:46.319700 INFO [src/bin.rs:782] Running on linux, aarch64
2025-08-20 20:14:47.223172 WARN [src/alsadevice.rs:242] Prepare capture device
2025-08-20 20:14:47.223565 INFO [src/alsadevice.rs:117] PB: Starting playback from Prepared state
2025-08-20 20:14:47.243582 INFO [src/alsadevice.rs:976] Capture device is stalled, processing is stalled
2025-08-20 20:14:47.244117 ERROR [src/bin.rs:314] Capture error: ALSA function 'snd_pcm_start' failed with error 'Broken pipe (32)'
2025-08-20 20:14:49.095041 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-20 20:14:49.140677 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-20 20:14:50.890889 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-20 20:14:50.935119 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-20 20:14:52.978335 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-20 20:14:53.023834 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-20 20:14:54.887279 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-20 20:14:54.932876 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-20 20:14:56.913690 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-20 20:14:56.956061 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-20 20:14:58.028498 WARN [src/processing.rs:97] Failed to build thread pool, error: The global thread pool has already been initialized.
2025-08-20 20:14:58.036068 INFO [src/alsadevice.rs:117] PB: Starting playback from Prepared state
2025-08-20 20:14:58.127595 WARN [src/alsadevice.rs:113] PB: Prepare playback after buffer underrun
2025-08-21 00:53:21.973277 WARN [src/alsadevice.rs:113] PB: Prepare playback after buffer underrun
2025-08-21 14:42:25.916019 WARN [src/alsadevice.rs:344] Capture: read overrun, trying to recover. Error: ALSA function 'snd_pcm_readi' failed with error 'Broken pipe (32)'
2025-08-21 14:42:25.936258 INFO [src/alsadevice.rs:976] Capture device is stalled, processing is stalled
2025-08-21 14:42:25.936544 ERROR [src/bin.rs:314] Capture error: ALSA function 'snd_pcm_start' failed with error 'Broken pipe (32)'
2025-08-21 14:42:26.215730 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:28.042931 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:28.085443 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:29.847599 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:29.891628 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:31.525982 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:31.551718 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:32.987963 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:33.013503 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:34.488399 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:34.513307 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:35.987081 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:36.012509 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:37.549365 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:37.574963 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:39.297671 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:39.341302 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:41.092034 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:41.134689 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
2025-08-21 14:42:42.768773 ERROR [src/socketserver.rs:1293] Config error: invalid type: unit value, expected struct Configuration at line 1 column 1
2025-08-21 14:42:42.793482 WARN [src/socketserver.rs:540] Lost connection: WebSocket protocol error: Connection reset without closing handshake
 
They seem to be preceeded by broken pipe errors / stalled state. Do you know why you are getting those broken pipe errors?

Code:
2025-08-20 20:14:47.243582 INFO [src/alsadevice.rs:976] Capture device is stalled, processing is stalled
2025-08-20 20:14:47.244117 ERROR [src/bin.rs:314] Capture error: ALSA function 'snd_pcm_start' failed with error 'Broken pipe (32)'

Code:
2025-08-21 14:42:25.916019 WARN [src/alsadevice.rs:344] Capture: read overrun, trying to recover. Error: ALSA function 'snd_pcm_readi' failed with error 'Broken pipe (32)'
2025-08-21 14:42:25.936258 INFO [src/alsadevice.rs:976] Capture device is stalled, processing is stalled
2025-08-21 14:42:25.936544 ERROR [src/bin.rs:314] Capture error: ALSA function 'snd_pcm_start' failed with error 'Broken pipe (32)'

Michael
 
They seem to be preceeded by broken pipe errors / stalled state. Do you know why you are getting those broken pipe errors?

Code:
2025-08-20 20:14:47.243582 INFO [src/alsadevice.rs:976] Capture device is stalled, processing is stalled
2025-08-20 20:14:47.244117 ERROR [src/bin.rs:314] Capture error: ALSA function 'snd_pcm_start' failed with error 'Broken pipe (32)'

Code:
2025-08-21 14:42:25.916019 WARN [src/alsadevice.rs:344] Capture: read overrun, trying to recover. Error: ALSA function 'snd_pcm_readi' failed with error 'Broken pipe (32)'
2025-08-21 14:42:25.936258 INFO [src/alsadevice.rs:976] Capture device is stalled, processing is stalled
2025-08-21 14:42:25.936544 ERROR [src/bin.rs:314] Capture error: ALSA function 'snd_pcm_start' failed with error 'Broken pipe (32)'

Michael
I’m not sure. It very rarely stops working but it does every few weeks or so. I installed this one closely following your tutorial on github, I don’t think I modded anything
 
Back
Top Bottom