• 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,515
Likes
3,371
Location
Detroit, MI
Michael,
I'm plodding through the install trying to get CamillaDSP V2 going, the manual start of camilladsp stops and exits due to waiting on websocket being disabled, so I will try to get the gui going. The service start does the same.
Have you an updated M4 config or Ultralite Mk5 config file yet ?

No, I have not updated any of the configurations and have just started updating the tutorial.

To convert a configuration from V1 to V2 you need to do a few things.

1) Delete the resampler_type field.
2) Delete the enable_resampling field.
3) Delete any volume filters from the filters and pipeline section.

You will also need to update your camilladsp.service to the latest version so that it runs as a normal user and not root.

Michael
 

Wirrunna

Member
Joined
May 27, 2021
Messages
93
Likes
45
Location
South Coast, NSW, Australia
No, I have not updated any of the configurations and have just started updating the tutorial.

To convert a configuration from V1 to V2 you need to do a few things.

1) Delete the resampler_type field.
2) Delete the enable_resampling field.
3) Delete any volume filters from the filters and pipeline section.

You will also need to update your camilladsp.service to the latest version so that it runs as a normal user and not root.

Michael
Thank you, just got GUI going. Did 3 will do 1 & 2 and keep trying on my Motu M4 test system on RPi5.
Will also check camilladsp.service.

I tried to build a version 1 system but can't get it to work, I suspect that I have a mixture of V1 and V2 components., so anyone starting from scratch using the tutorial will run into problems.
 

Wirrunna

Member
Joined
May 27, 2021
Messages
93
Likes
45
Location
South Coast, NSW, Australia
Michael,
You wrote
"You will also need to update your camilladsp.service to the latest version so that it runs as a normal user and not root."

I first got things going with the camilladsp.service based on the screendump in your post here

but found I needed "-w" parameter


[Unit] After=syslog.target StartLimitIntervalSec=10 StartLimitBurst=10 [Service] Type=simple ExecStart=/home/camilla/camilladsp/camilladsp -w -s ~/camilladsp/statefile.yml -o ~/camilladsp/camilladsp.log -p 1234 --gain=-40 Restart=always RestartSec=1 StandardOutput=journal StandardError=journal SyslogIdentifier=camilladsp User=root Group=root CPUSchedulingPolicy=fifo CPUSchedulingPriority=10 [Install] WantedBy=multi-user.target

Should the User=root line be changed to User=username, in my case "camilla"

camilla@RPi5bM4:~$ sudo systemctl status camilladsp ● camilladsp.service Loaded: loaded (/lib/systemd/system/camilladsp.service; enabled; preset: enabled) Active: active (running) since Fri 2023-12-15 08:52:05 AEDT; 33min ago Main PID: 640 (camilladsp) Tasks: 10 (limit: 4556) Memory: 6.1M CPU: 15.426s CGroup: /system.slice/camilladsp.service └─640 /home/camilla/camilladsp/camilladsp -w -s ~/camilladsp/statefile.yml -o ~/camilladsp/camilladsp.log -p 1234 --gain=-40 Dec 15 08:52:05 RPi5bM4 systemd[1]: Started camilladsp.service.
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,515
Likes
3,371
Location
Detroit, MI
Michael,
You wrote
"You will also need to update your camilladsp.service to the latest version so that it runs as a normal user and not root."

I first got things going with the camilladsp.service based on the screendump in your post here

but found I needed "-w" parameter


[Unit] After=syslog.target StartLimitIntervalSec=10 StartLimitBurst=10 [Service] Type=simple ExecStart=/home/camilla/camilladsp/camilladsp -w -s ~/camilladsp/statefile.yml -o ~/camilladsp/camilladsp.log -p 1234 --gain=-40 Restart=always RestartSec=1 StandardOutput=journal StandardError=journal SyslogIdentifier=camilladsp User=root Group=root CPUSchedulingPolicy=fifo CPUSchedulingPriority=10 [Install] WantedBy=multi-user.target

Should the User=root line be changed to User=username, in my case "camilla"

camilla@RPi5bM4:~$ sudo systemctl status camilladsp ● camilladsp.service Loaded: loaded (/lib/systemd/system/camilladsp.service; enabled; preset: enabled) Active: active (running) since Fri 2023-12-15 08:52:05 AEDT; 33min ago Main PID: 640 (camilladsp) Tasks: 10 (limit: 4556) Memory: 6.1M CPU: 15.426s CGroup: /system.slice/camilladsp.service └─640 /home/camilla/camilladsp/camilladsp -w -s ~/camilladsp/statefile.yml -o ~/camilladsp/camilladsp.log -p 1234 --gain=-40 Dec 15 08:52:05 RPi5bM4 systemd[1]: Started camilladsp.service.

The reason to use your username ("camilla" in your case) is that if camilladsp is run as root, the statefile is created with root as owner and the GUI will not be able to modify it. Running as a normal user prevents this.

You can run "ls -l" to check ownership of statefile.yml.

Code:
michael3@raspberrypi3:~/camilladsp$ ls -l
total 7048
-rw-rw-r-- 1 michael3 michael3 3309597 Dec 12 16:05 camilladsp-linux-aarch64.tar.gz
-rw-r--r-- 1 michael3 michael3 1821157 Dec 14 16:17 camilladsp.log
drwxrwxr-x 5 michael3 michael3    4096 Dec 13 09:00 camillagui
-rw-rw-r-- 1 michael3 michael3 2056704 Dec 12 16:04 camillagui.zip
drwxrwxr-x 2 michael3 michael3    4096 Dec 13 08:57 coeffs
drwxrwxr-x 2 michael3 michael3    4096 Dec 14 13:49 configs
-rw-r--r-- 1 michael3 michael3     210 Dec 14 16:15 statefile.yml

Michael
 

somebodyelse

Major Contributor
Joined
Dec 5, 2018
Messages
3,759
Likes
3,067
The reason to use your username ("camilla" in your case) is that if camilladsp is run as root, the statefile is created with root as owner and the GUI will not be able to modify it. Running as a normal user prevents this.
From the listing in your post statefile.yml is only writable by the user, so the key is to make sure both camilladsp and the gui are running as the same user. Running services as a non-root user is good security practice anyway.
 

Elfsberg

Member
Joined
Feb 14, 2022
Messages
50
Likes
26
Location
Sweden, Falun
Oh, wow, 50 pages to catch up to since I last checked in. :D:cool:

My DSP is running every day just fine and my whole family is reaping the benefits. However I have run into one little issue that surely must be easy to fix.

I've changed the name of my network on my router, and editing networkconfig.txt gets me nowhere. I just edited the name and password.

Anyone?

Thanks
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,515
Likes
3,371
Location
Detroit, MI
Oh, wow, 50 pages to catch up to since I last checked in. :D:cool:

My DSP is running every day just fine and my whole family is reaping the benefits. However I have run into one little issue that surely must be easy to fix.

I've changed the name of my network on my router, and editing networkconfig.txt gets me nowhere. I just edited the name and password.

Anyone?

Thanks

I assume you are using Ubuntu? If so it is a little tricky but overall not too difficult.

Rich (BB code):
sudo cp /etc/netplan/50-cloud-init.yaml /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg
sudo nano /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg

You should see something like the following. You can change the networkname and password which are shown bolded below. As a side note, if you have issues with your RPi taking a long time to reboot you can try commenting out the optional: true line as shown below.

Rich (BB code):
network:
    version: 2
    wifis:
        renderer: networkd
        wlan0:
            access-points:
                networkname:
                    password: password
            dhcp4: true
#            optional: true

Apply the following commands to apply and reboot.

Rich (BB code):
sudo cloud-init clean
sudo cloud-init init
sudo reboot

Michael
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,515
Likes
3,371
Location
Detroit, MI
Tutorial has been updated to reflect CamillaDSP V2. I went through fresh installs today following the tutorial and can confirm it works with both Ubuntu Server 22.04 and 23.10.

The change from V1 to V2 is significant. It is important to note that V1 configuration files will not work on V2 due to nomenclature changes. Similarly old version of oled.py and flirc.py will not work on V2 due to nomenclature changes. As a result, if you are going from V1 to V2 I recommend you completely replace all of your services (camilladsp.service, camillagui.service, oled.service and flirc.service) and any scripts in use (flirc.py and oled.py).

If you have an existing V1 configuration that you would like to use in V2, I recommend the following steps.

1) Delete line containing enable_sampling.
2) Delete line contain resampler_type.
3) Delete volume filter from Filters section.
4) Delete any volume filter references from Pipeline section.
5) After making the changes above, load your configuration into the GUI.
6) If you previously had resampling applied use the GUI to re-implement resampling.
7) Save the configuration in the GUI.

These are the steps that I followed to convert the V1 configurations attached to the tutorial to V2.

Michael
 

Wirrunna

Member
Joined
May 27, 2021
Messages
93
Likes
45
Location
South Coast, NSW, Australia
Michael,
Thank you for the updated tutorial. I have got my Motu M4 test system running CamillaDSP V2 on an RPi5 (with the 2023/12/6 firmware), Ubuntu 23.10, Squeezelite input, FLIRC and OLED display (line: chip = sbc.gpiochip_open(0) to chip = sbc.gpiochip_open(4) in oled-lgpio.py).
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,659
Likes
2,272
Michael,
Thank you for the updated tutorial. I have got my Motu M4 test system running CamillaDSP V2 on an RPi5 (with the 2023/12/6 firmware), Ubuntu 23.10, Squeezelite input, FLIRC and OLED display (line: chip = sbc.gpiochip_open(0) to chip = sbc.gpiochip_open(4) in oled-lgpio.py).
Are you using the cooler with the pi 5? How is it either with (fan noise) or without (does it get hot doing only DSP?). Thanks.
 

Wirrunna

Member
Joined
May 27, 2021
Messages
93
Likes
45
Location
South Coast, NSW, Australia
Are you using the cooler with the pi 5? How is it either with (fan noise) or without (does it get hot doing only DSP?). Thanks.
I got 2 RPi 5s, one with a case and one with the cooler fan. Both screamed like a banshee as Ubuntu 23.10 doesn't yet have fan control - its flat chat or pull the plug. The work around is here
https://dev.webonomic.nl/controlling-the-fan-of-the-raspberry-pi-5-in-ubuntu-23-10 ,
but I went and ordered a pair of passive cases -
Still gets warm but not hot, depends on the enclosure they are in, and they are silent.
 
  • Like
Reactions: MCH

Wirrunna

Member
Joined
May 27, 2021
Messages
93
Likes
45
Location
South Coast, NSW, Australia
I have now moved my Motu Ultralight system to V2 on an RPi 5. This is a three way crossover with a mixture of FIR and IIR filters.
Conversion of the V1 configuration to V2 was simpler than I expected, the steps were:
1. Using a text editor (I used the edit function in WinSCP), delete lines containing enable_resampling and resampler_type.
2. Load the config in the V2 GUI.
3. In the Filters tab, delete the Volume filter and save to file. This deletes all references to Volume filter in the pipeline.
4. Redo resampling according to Michael's updated example scripts from post #4 of this thread and save.

I immediately noticed that the V2 system was playing louder, the input appeared at least 10db higher than when playing on an RPi 4, maybe something to do with the volume filters being removed.
Ubuntu 23.10 has been a bit rocky as expected on the RPi 5. The 2023/12/6 firmware on the RPi and the latest Ubuntu updates seem to have sorted the Squeezelite to LMS connection.
The passive heatsink case is a must, avoid the fan for the RPi 5.
The new GUI shows the DSP Load which on my system goes from 8.5% up to 13%.

The RPi 5 is obviously overkill, but I can't resist new toys, and this is winning a trifecta - new version of CamillaDSP, new processor in the RPi 5 and new updated OS - what could possibly go wrong !
 

Blew

Active Member
Joined
Jul 24, 2020
Messages
179
Likes
63
Location
Sydney, Australia
Just a note to say that I finally got around to setting up flirc on my pi4 running Debian, which means the process is slightly different. The user running the python script (in my case "camilladsp") needs to be added to the "input" group before the script can interact with flirc:
sudo usermod -a -G input camilladsp
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,659
Likes
2,272
hello gang,

I am thinking on a future second system where i will not have the convenience of a minidsp resampling the different sources to a constant sample rate (this is what i do in my current setup). I am thinking of building a sort of hat for raspberry pi that would have a couple of spdif inputs, a muxer, and a SRC4192 to resample all the inputs to a fixed sample rate. From there, i2s to the rpi.

Does anyone have any experience with SRC4192/3 or similar and rpi/camilladsp? any glitches or pops when switching sample rates? (the minidsp works very well and i would love to achieve something similar). Anyone knows any similar IC that does both resampling and muxer or that takes spdif directly?
Also, it has been a while since i don't tinker with all this, and i might have missed something. Is there finally any software based solution to the switching sample rates issues?
thanks!

 

Blew

Active Member
Joined
Jul 24, 2020
Messages
179
Likes
63
Location
Sydney, Australia
Tutorial has been updated to reflect CamillaDSP V2. I went through fresh installs today following the tutorial and can confirm it works with both Ubuntu Server 22.04 and 23.10.

The change from V1 to V2 is significant. It is important to note that V1 configuration files will not work on V2 due to nomenclature changes. Similarly old version of oled.py and flirc.py will not work on V2 due to nomenclature changes. As a result, if you are going from V1 to V2 I recommend you completely replace all of your services (camilladsp.service, camillagui.service, oled.service and flirc.service) and any scripts in use (flirc.py and oled.py).

If you have an existing V1 configuration that you would like to use in V2, I recommend the following steps.

1) Delete line containing enable_sampling.
2) Delete line contain resampler_type.
3) Delete volume filter from Filters section.
4) Delete any volume filter references from Pipeline section.
5) After making the changes above, load your configuration into the GUI.
6) If you previously had resampling applied use the GUI to re-implement resampling.
7) Save the configuration in the GUI.

These are the steps that I followed to convert the V1 configurations attached to the tutorial to V2.

Michael
Thanks for this. I've now upgraded to CamillaDSP V2 and it's working well. However, I can't get your flirc script to switch input configs via the remote. The other controls work but not switch configs.
This is the output when running the script on the command line. I see the same output in syslog when it's run via the service script.

camilladsp@pi4-lounge:~/camilladsp $ python3 flirc_08302023.py Traceback (most recent call last): File "/opt/camilladsp/camilladsp/flirc_08302023.py", line 91, in <module> main() File "/opt/camilladsp/camilladsp/flirc_08302023.py", line 66, in main cdsp.config.set_file_path(newconfig) UnboundLocalError: local variable 'newconfig' referenced before assignment Exception ignored in: <function InputDevice.__del__ at 0x7fab2f0e50> Traceback (most recent call last): File "/usr/lib/python3/dist-packages/evdev/device.py", line 160, in __del__ File "/usr/lib/python3/dist-packages/evdev/device.py", line 305, in close File "/usr/lib/python3/dist-packages/evdev/eventio_async.py", line 55, in close File "/usr/lib/python3.9/asyncio/events.py", line 725, in get_event_loop_policy File "/usr/lib/python3.9/asyncio/events.py", line 718, in _init_event_loop_policy ImportError: sys.meta_path is None, Python is likely shutting down

I have two config files which I've renamed to begin with "_". I can switch between them when using the shortcuts menu in the CDSP GUI. This is what the statefile looks like after switching between them:

camilladsp@pi4-lounge:~/camilladsp $ cat statefile.yml --- config_path: /opt/camilladsp/camilladsp/configs/_m4-squeezelite-crossovers.yml mute: - false - false - false - false - false volume: - -0.0 - -0.0 - -0.0 - -0.0 - -0.0 camilladsp@pi4-lounge:~/camilladsp $ cat statefile.yml --- config_path: /opt/camilladsp/camilladsp/configs/_m4-cd-crossovers.yml mute: - false - false - false - false - false volume: - -0.0 - -0.0 - -0.0 - -0.0 - -0.0

I've tried to debug it by setting the newconfig variable in various other places in the script, but my Python is not great so I'm pretty much stabbing in the dark at this point. I've also tried using the previous the V2 version of the flirc python script (flirc_08242023.py) that you've posted in this thread but it has the same issue.

Any ideas what the problem might be?
Also, any chance you could add a few comments in the script to give us an idea of what it's doing in places?

NB: I noticed that the flirc device name changed after updating the firmware (yes I updated the flirc script with the correct device name).
Original firmware: /dev/input/by-id/usb-flirc.tv_flirc-if01-event-kbd
Updated firmware: /dev/input/by-id/usb-flirc.tv_flirc_656B97A650583234342E3120FF02140D-if01-event-kbd
 

melomane13

Member
Joined
Jul 24, 2023
Messages
99
Likes
70
Location
France
@Blew , have you marked one config as active ?
so you can also make this change:

#active = cdsp.config.file_path()
#configdir = active.split('camilladsp')[0] + 'camilladsp/' + 'configs/'

configdir = os.path.expanduser( '~' ) + '/camilladsp/' + 'configs/'
 
Last edited:

dwa

Member
Joined
Jan 24, 2020
Messages
28
Likes
33
Maybe someone can help me out. When using camillaDSP on RPi with Hifiberry DAC+ ADC, would it be possible to mix analog source (OEM head unit) with UPnP source and output it together through DAC part of Hifiberry? I would like to keep audio from car's park sensors, warnings and navigation and mix it with music from UPnP or Spotify.
 

Blew

Active Member
Joined
Jul 24, 2020
Messages
179
Likes
63
Location
Sydney, Australia
@Blew , have you marked one config as active ?
so you can also make this change:
Yes the config is marked as active.
#active = cdsp.config.file_path()
#configdir = active.split('camilladsp')[0] + 'camilladsp/' + 'configs/'

configdir = os.path.expanduser( '~' ) + '/camilladsp/' + 'configs/'
This worked! Thanks for this.
 

Blew

Active Member
Joined
Jul 24, 2020
Messages
179
Likes
63
Location
Sydney, Australia
Maybe someone can help me out. When using camillaDSP on RPi with Hifiberry DAC+ ADC, would it be possible to mix analog source (OEM head unit) with UPnP source and output it together through DAC part of Hifiberry? I would like to keep audio from car's park sensors, warnings and navigation and mix it with music from UPnP or Spotify.
You should be able to do this in asound.conf, but it means that audio passes through the ALSA mixer and resampler which isn't the best quality.
 

dwa

Member
Joined
Jan 24, 2020
Messages
28
Likes
33
You should be able to do this in asound.conf, but it means that audio passes through the ALSA mixer and resampler which isn't the best quality.
Thanks. Maybe there is some other way, with different ADC/DAC that would give higher quality output and isn't very expensive? I didn't yet buy any ADC/DAC yet, still making "research".
 
Top Bottom