• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. 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!

RPi4 + CamillaDSP Tutorial

OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
I will give it a go then and see how it goes. Rocky Linux is the successor of CentOS which in turn is a community version of Red Hat Enterprise Linux (RHEL).
How is the resource consumption on the RPi when running CamillaDSP and actively EQ'ing audio? Is there a lot of margin left for running any other processes on the side?

Here is top output for 8 channel DSP, 96 kHz, IIR filters only and no resampling. It uses about 18% of a single core for CamillaDSP and another 5-6% if you are using the GUI (python3 in example below).

1670248642956.png


I don't really do anything on these RPis other than use them for audio so can't really say how they will do running other stuff at the same time. In my office setup I also run streaming programs (shairport-sync, squeezelite) and python scripts for the OLED and FLIRC and it doesn't have an issue. That being said running a lot of other stuff doesn't seem like a good idea.

Michael
 

juliangst

Addicted to Fun and Learning
Joined
Dec 11, 2021
Messages
970
Likes
992
Location
Germany
What is the best way to get Spotify Connect running on the Pi?
I tried SpoCon which basically uses librespot but only my PC can find the Spotify Connect endpoint and can't even connect to it
 

Unkown

Member
Joined
Oct 17, 2022
Messages
10
Likes
2
Many thanks for everyone in this forum and special thanks to @mdsimon2 for your contributions.

I have Camille DSP running with EQ filters which was much needed to tame those bright highs.
 
  • Like
Reactions: MCH

grizaudio

Member
Joined
Jan 3, 2021
Messages
30
Likes
7
Here is top output for 8 channel DSP, 96 kHz, IIR filters only and no resampling. It uses about 18% of a single core for CamillaDSP and another 5-6% if you are using the GUI (python3 in example below).

View attachment 247944

I don't really do anything on these RPis other than use them for audio so can't really say how they will do running other stuff at the same time. In my office setup I also run streaming programs (shairport-sync, squeezelite) and python scripts for the OLED and FLIRC and it doesn't have an issue. That being said running a lot of other stuff doesn't seem like a good idea.

Michael

EDIT: found the link: https://github.com/scripple/alsa_cdsp
It would be great if someone could tie all this together into an SD card image.

Hi Michael, thanks very much for your tutorial, the instruction & information is super helpful.

I run an active speaker system, which uses FIR filters for crossover.
I have been considering LMS/CamillaDSP because I get "random" pops when I select skip/pause and play using Roon.
Apparently the issue has something to do with the way RAAT has been designed, and RAAT cannot provide fade in / fade out like LMS, atm.

My system signal path is:
Intel NUC S4 Roon Rock > (USB) > RPi4 >(USB) > Intona 7055 (USB) > Motu UL MK5 > 3x NAD c298 in low gain > JBL M2

I was hoping to try CamillaDSP + LMS on a RPI4, but I would like to auto sampling rate changes.
Have you managed to get auto sampling rate changes working?

Many thanks
 
Last edited:

arvidb

Member
Joined
Dec 1, 2022
Messages
96
Likes
114
Location
Sweden
First: apologies if my question has been asked before. If so my search-fu has failed me. :)

I'm using CamillaDSP for (biquad) room correction with ALSA as backend on my main PC. I have set it up like so:

ALSA dmix as default device to receive concurrent streams with different bit rates. All are resampled to 48 kHz (the max supported by my DAC, a Lexicon Alpha) using alsa-plugins' libresample libsamplerate (which in turn uses sinc interpolation, if I understand correctly). Below is my entire /etc/asound.conf:

defaults.ctl.!card Alpha defaults.pcm.rate_converter "samplerate_medium" pcm.!default { type plug slave.pcm "dmix:CARD=Loopback,RATE=48000,FORMAT=S32_LE" }


CamillaDSP is set up like this:

devices: samplerate: 48000 chunksize: 1024 capture: type: Alsa channels: 2 device: "hw:Loopback,1" format: S32LE playback: type: Alsa channels: 2 device: "hw:Alpha" format: S24LE3 filters: ... pipeline: - type: Filter channel: 0 names: - lp6_left_1 - lp6_left_2 - lp6_left_3 - lp6_left_4 - lp6_left_5 - type: Filter channel: 1 names: - lp6_right_1 - lp6_right_2 - lp6_right_3 - lp6_right_4 - lp6_right_5 - lp6_right_6


This seems to work great, except that I get clipping (CamillaDSP warns "Clipping detected" pretty much constantly).

Since sinc interpolation can cause clipping all by itself, I want to attenuate before resampling rather than in CamillaDSP. I.e. somehow increase the resolution of the streams, then apply some attenuation, and then perform the resampling + mixing. All this before handing the resulting stream off to Camilla DSP for filtering.

Any ideas on how to do this? I cannot make much sense of ALSA's configuration syntax - or ALSA in general really!
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
I was hoping to try CamillaDSP + LMS on a RPI4, but I would like to auto sampling rate changes.
Have you managed to get auto sampling rate changes working?

I did experiment running the RPi as a USB gadget following the instructions here -> https://www.audiosciencereview.com/...ce-ipad-and-usb-dac.25414/page-3#post-1180356 and gaudio_ctl utility handles auto sample rate changes well.

But in general I have not pursued auto sample rate changing. Both gaudio_ctl and the alsa_cdsp plugin do not function with symlink configuration files and I much prefer to use a symlink configuration so that I can easily change configuration files via the GUI. Rate changing is a good approach if you only have one configuration that you want to implement across a range of sample rates but if you want to change between different configuration files it gets messy.

The one area where I might pursue auto rate changing in the future is to see if I can write a python script to detect rate changes using the hifyme TOSLINK to USB cards. But this is a different problem to solve compared to LMS / squeezelite where you can easily resample in software.

Michael
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
First: apologies if my question has been asked before. If so my search-fu has failed me. :)

I'm using CamillaDSP for (biquad) room correction with ALSA as backend on my main PC. I have set it up like so:

ALSA dmix as default device to receive concurrent streams with different bit rates. All are resampled to 48 kHz (the max supported by my DAC, a Lexicon Alpha) using alsa-plugins' libresample (which in turn uses sinc interpolation, if I understand correctly). Below is my entire /etc/asound.conf:

defaults.ctl.!card Alpha defaults.pcm.rate_converter "samplerate_medium" pcm.!default { type plug slave.pcm "dmix:CARD=Loopback,RATE=48000,FORMAT=S32_LE" }


CamillaDSP is set up like this:

devices: samplerate: 48000 chunksize: 1024 capture: type: Alsa channels: 2 device: "hw:Loopback,1" format: S32LE playback: type: Alsa channels: 2 device: "hw:Alpha" format: S24LE3 filters: ... pipeline: - type: Filter channel: 0 names: - lp6_left_1 - lp6_left_2 - lp6_left_3 - lp6_left_4 - lp6_left_5 - type: Filter channel: 1 names: - lp6_right_1 - lp6_right_2 - lp6_right_3 - lp6_right_4 - lp6_right_5 - lp6_right_6


This seems to work great, except that I get clipping (CamillaDSP warns "Clipping detected" pretty much constantly).

Since sinc interpolation can cause clipping all by itself, I want to attenuate before resampling rather than in CamillaDSP. I.e. somehow increase the resolution of the streams, then apply some attenuation, and then perform the resampling + mixing. All this before handing the resulting stream off to Camilla DSP for filtering.

Any ideas on how to do this? I cannot make much sense of ALSA's configuration syntax - or ALSA in general really!

CamillaDSP only reports clipping that is caused by CamillaDSP itself. It is possible that the ALSA resampling operation is causing clipping but it won't be reported by CamillaDSP.

The issue is most likely that your filters have some amount of boost but you have no attenuation in your CamillaDSP configuration file. I would add attenuation in CamillaDSP until the clipping warnings go away.

Also in my limited experience with ALSA resampling I found that it was very low quality -> https://www.audiosciencereview.com/...tu-m4-phenomal-dsp-streamer.24493/post-834917, not sure if that is still the case but you might want to re-think your approach.

Michael
 

arvidb

Member
Joined
Dec 1, 2022
Messages
96
Likes
114
Location
Sweden
CamillaDSP only reports clipping that is caused by CamillaDSP itself. It is possible that the ALSA resampling operation is causing clipping but it won't be reported by CamillaDSP.
Yes, well, I'm more interested in getting rid of the clipping than getting rid of CamillaDSP's warnings. ;) While attenuation in CamillaDSP would take care of any clipping caused by its filters, I want to ensure there's no clipping at all. (All my filters have negative amplification BTW, but I guess there can be some ringing? Not an expert...)

Also in my limited experience with ALSA resampling I found that it was very low quality -> https://www.audiosciencereview.com/...tu-m4-phenomal-dsp-streamer.24493/post-834917, not sure if that is still the case but you might want to re-think your approach.
ALSA's default resampler is apparently pretty horrible, but libsamplerate's (sorry, not libresample as I wrote above!) quality should be excellent if you believe what's said on the internet. :) (Source: https://hydrogenaud.io/index.php/topic,47591.0.html) It claims 145 dB signal-to-noise ratio for its best converter. :)

That said, I'm not a stranger to doing things differently, if there is a better way.
 

grizaudio

Member
Joined
Jan 3, 2021
Messages
30
Likes
7
Hi hoping for some help:
I followed the instructions (Or I believe I did), but I cant get Camilla DSP to activate, the selection is greyed out...any ideas?
When I float my cursor over the A button, it says "disabled since backend is not able to store the active config file".
LMS see's the player....
1670337522098.png


1670337533470.png

1670337553298.png

1670337677914.png
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
Yes, well, I'm more interested in getting rid of the clipping than getting rid of CamillaDSP's warnings. ;) While attenuation in CamillaDSP would take care of any clipping caused by its filters, I want to ensure there's no clipping at all. (All my filters have negative amplification BTW, but I guess there can be some ringing? Not an expert...)


ALSA's default resampler is apparently pretty horrible, but libsamplerate's (sorry, not libresample as I wrote above!) quality should be excellent if you believe what's said on the internet. :) (Source: https://hydrogenaud.io/index.php/topic,47591.0.html) It claims 145 dB signal-to-noise ratio for its best converter. :)

That said, I'm not a stranger to doing things differently, if there is a better way.

Wow, you are right, thank you for sharing! Just tried the samplerate_medium resampler and it looks great.

Here is the default resampler playing a 1 kHz 24 bit test tone at 96 kHz going in to a CamillaDSP configuration running at 44.1 kHz.

Screen Shot 2022-12-06 at 9.49.06 AM.png


And here is samplerate_medium, 17 dB improvement in noise!

Screen Shot 2022-12-06 at 9.51.16 AM.png


These are just quick and dirty DAC output measurements, imagine digital output / input measurements look much better.

Michael
 

arvidb

Member
Joined
Dec 1, 2022
Messages
96
Likes
114
Location
Sweden
Wow, you are right, thank you for sharing! Just tried the samplerate_medium resampler and it looks great.
<...>
And here is samplerate_medium, 17 dB improvement in noise!
Wow, thanks for testing! Edit: Fantastic to get some confirmation of the quality!
 
Last edited:

grizaudio

Member
Joined
Jan 3, 2021
Messages
30
Likes
7
Hi hoping for some help:
I followed the instructions (Or I believe I did), but I cant get Camilla DSP to activate, the selection is greyed out...any ideas?
When I float my cursor over the A button, it says "disabled since backend is not able to store the active config file".
LMS see's the player....
View attachment 248162

View attachment 248163
View attachment 248166
View attachment 248168

Coincidentally I'm getting the following error, if I start camillaDSP manually in terminal...
2022-12-06 15:00:13.230941 ERROR [src/bin.rs:344] Playback error: ALSA function 'snd_pcm_hw_params_set_channels' failed with error 'EINVAL: Invalid argument'
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
@grizaudio Did you change update_config_symlink in camillagui.yml from false to true?

1670339399984.png


Can you share the command you attempted to use to start manually from the terminal? I am interested in if you specified a specific configuration file or active_config.yml.

Michael
 

alto

Member
Joined
Oct 2, 2021
Messages
38
Likes
7
I'm looking at getting a power supply with a barrel connector to make an adapter that will connect to the GPIO pins.
Do I need a linear power supply for this application, or can I get switching one and it'll be fine?
 

grizaudio

Member
Joined
Jan 3, 2021
Messages
30
Likes
7
Ok, after checking again, and rebooting, it seems to be active.
I noticed if I change the mixer size, and align the pipeline the service goes offline.
I just muted on the mixer instead.

Thanks

1670367759217.png
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
I used this command: sudo systemctl enable camilladsp

This will start the CamillaDSP service. Before starting the service did you try starting directly from the command line with a specific configuration file as described in the steps below?

1670367632974.png


If not I would disable the service by running "sudo service camilladsp stop" and then getting it working manually from the command line.

That still seems like a separate issue from your active_config.yml issue. I assume you updated camillagui.yml before starting the camillagui service? Might not be a bad idea to try restarting the camillagui service by running "sudo service camillagui restart" to see if that fixes anything.

Michael
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
I'm looking at getting a power supply with a barrel connector to make an adapter that will connect to the GPIO pins.
Do I need a linear power supply for this application, or can I get switching one and it'll be fine?

I've only used switching power supplies and observe no measurable degradation of the DAC output. The standard RPi4 USB-C power supply works fine with a USB-C to barrel adapter.

Michael
 
Top Bottom