• 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

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,641
Likes
2,251
@dfgoiuj what topping dac exactly? I have used the ICUSBAUDIO7D extensively with toslink directly to a topping D30pro, famous for its spdif issues, and never had a problem (my d30pro does have problems with other spdif sources)

I did experience, at the beginning, sound dropouts due to buffer underruns as Michael explained, but solved them playing with chunksize and that stuff. In any case, those where dropouts, never pops nor noises.

I never tried the icusbaudio-camilladsp with with the pi 3 though...
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
501
Likes
323
ICUSBAUDIO7D uses CM6206 http://www.datasheet.es/download.php?id=718705 . IIRC that chip has USB async input and adaptive output https://lists.freebsd.org/pipermail/freebsd-usb/2013-October/012458.html . Async input means it CAN clock input data with the incoming SPDIF rate (but not guaranteed, I did not find any details in the datasheet). Adaptive output means the output stream is clocked at rate of the USB controller (i.e. RPi clock).

If the input is really clocked by the SPDIF input (i.e. input and output run at a different rate), enabling rate_adjust and asynchronous resampling in CDSP should help. If the input is clocked by the output clock (i.e. the RPi clock), then glitches occur already in the soundcard input circuitry. More likely the former is the case, otherwise the device would be complete crap for duplex operation with toslink input.
 

chuckt62

Active Member
Editor
Joined
Apr 6, 2022
Messages
141
Likes
123
Location
Tejas
Glad to hear you got it up and running!

On Ubuntu 21.10 I would have said download and install the arm deb from here -> https://downloads.slimdevices.com/LogitechMediaServer_v8.2.0/.

Code:
sudo apt install libio-socket-ssl-perl
wget https://downloads.slimdevices.com/LogitechMediaServer_v8.2.0/logitechmediaserver_8.2.0_arm.deb
sudo dpkg -i logitechmediaserver_8.2.0_arm.deb

Unfortunately Ubuntu 22.04 runs Perl 5.34 which is not currently supported by LMS. I was able to build my own LMS that supports Perl 5.34 more or less following these instructions -> https://angerman.net/articles/lms/ but I would not recommend that to a beginner.

Running a separate RPi with LMS is probably the simplest option. I believe Raspberry Pi OS includes LMS as a package so it is very easy to install using apt. Otherwise I've used Ubuntu 20.04 and that also works well but you need to install LMS via the instructions above. @MarcosCh has a tutorial here for setting up LMS using PiCorePlayer -> https://www.audiosciencereview.com/...-step-by-step-instructions-for-dummies.33528/.

I am not a LMS guru by any means so I am sure there are other better options. If it is just Spotify you are after then the instructions below will install librespot, although to be honest a working LMS setup gives the same thing but is more straight forward.

1) Install Rust

Code:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Enter 1 at the prompt to select Select 1) Proceed with installation (default) and press enter.

Reboot RPi.

Code:
sudo reboot

Log back in to RPi

Code:
ssh username@hostname

2) Install dependencies

Code:
sudo apt install build-essential libasound2-dev pkg-config

3) Download and install librespot

This assumes you are installing this in /home/username/. You can verify your location using pwd.

Code:
git clone https://github.com/librespot-org/librespot
cd librespot
cargo build --release --no-default-features --features alsa-backend

Compiling librespot will take 10-15 minutes on a RPi4.

4) Try librespot

Rich (BB code):
/home/username/librespot/target/release/librespot --format S32 --device hw:Loopback,1

You should now see a device called Librespot in your Spotify app.

5) Setup service to automatically start Librespot.

Code:
sudo nano /lib/systemd/system/librespot.service

You will need to update your username.

Rich (BB code):
[Unit]
Description=Spotify Connect
After=multi-user.target

[Service]
User=username
Type=idle
ExecStart=/home/username/librespot/target/release/librespot --format S32 --device hw:Loopback,1

[Install]
WantedBy=multi-user.target

Reboot the RPi.

Code:
sudo reboot

Good luck!

Michael
@mdsimon2, I saw a post that the LMS/Perl 5.34 issue is solved w/LMS 8.3. I'll se if I can get it going with that LMS version.
 

dfgoiuj

Member
Joined
Mar 22, 2022
Messages
43
Likes
5
Hmm...a lot of potential issues but I do not see a smoking gun, here are a few thoughts.

First look at the CamillaDSP log to see if there is any evidence of buffer underruns or any other weird issues. If there are buffer underruns it likely means that you need to increase chunk size and potentially enable resampling / rate adjust. I would also look in alsamixer to see if there are any clocking options for the ICUSBAUDIO7, you want to clock from the TOSLINK input not the internal clock.

I assume you are using the TOSLINK output of the ICUSBAUDIO7 directly in to the Topping DAC? If so most newer Topping DACs have issues with some TOSLINK sources and that may be the culprit. You could try using the Topping DAC as a playback device in CamillaDSP (basically use the USB input of the Topping DAC), however you would definitely need to enable resampling and rate adjust to bridge the clock domains.

As @EdW some folks have reported issues using USB audio out of RPi3s but this sounds more like a clocking issue IMHO.

EDIT: One final thing I forgot, the digital output of some TVs is really bad. I get the occasional drop out with every DAC I’ve tried with my TV and the quantitatively the output won’t even retain 16 bit fidelity.

Michael

Correct, I'm taking the TOSLINK output on the ICUSBAUDIO7 straight into the Topping E30. I've used this configuration before with good results, but with a Windows machine driving the audio. Likewise with the digital output from the TV (LG C8) into the ICUSBAUDIO7 - it's always been fine to my ears. I wonder if the RPi USB is to blame after all. I do have a Hifiberry Digi+ I/O I could try, but I've read that they're not the best for this job.
 

chuckt62

Active Member
Editor
Joined
Apr 6, 2022
Messages
141
Likes
123
Location
Tejas
Only on x86_64, not on arm/aarch64, it has not been fixed yet, I've tried it.

Michael
Maybe I'll try it on the miniPC then.
 

dfgoiuj

Member
Joined
Mar 22, 2022
Messages
43
Likes
5
@dfgoiuj what topping dac exactly? I have used the ICUSBAUDIO7D extensively with toslink directly to a topping D30pro, famous for its spdif issues, and never had a problem (my d30pro does have problems with other spdif sources)

I did experience, at the beginning, sound dropouts due to buffer underruns as Michael explained, but solved them playing with chunksize and that stuff. In any case, those where dropouts, never pops nor noises.

I never tried the icusbaudio-camilladsp with with the pi 3 though...
Hi MarcosCh, thanks for a great guide. The DAC is a Topping E30. I've not had any problems with this combination running off Windows, so it must be something to do with the RPi.
 
  • Like
Reactions: MCH

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,641
Likes
2,251
Hey guys, what would you think about using a ddrc-22d to process with dirac live a stereo signal and then spdif to camilladsp to do xovers to 2 mains + 2 subs? Feasible or is there any intrinsic problem with it? (I've not used dirac before, just thinking out loud)
 

chuckt62

Active Member
Editor
Joined
Apr 6, 2022
Messages
141
Likes
123
Location
Tejas
Maybe I'll try it on the miniPC then.
@mdsimon2 , Now I can play from my local lib and CamillaDSP sees the input, but I don't see anything on the output.
I'm still using your M4_streamer.yml config.
Any Ideas?
1655491306170.png
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
Hey guys, what would you think about using a ddrc-22d to process with dirac live a stereo signal and then spdif to camilladsp to do xovers to 2 mains + 2 subs? Feasible or is there any intrinsic problem with it? (I've not used dirac before, just thinking out loud)

Sure, this will work with any of the miniDSP Dirac devices with digital output, heck it will work with any of the Dirac devices with bi-directional USB audio if you can use the USB output of your RPi. For example you could use a DDRC-24 to give you a TOSLINK/analog input and use that as your CamillaDSP capture device and then use a multichannel USB DAC as your CamillaDSP playback device.

I'd probably stay away from the DDRC-22D as I think it is too expensive for what it is and either go cheap with DDRC-24 or more expensive but more full featured with the Flex or SHD Studio. Of course if you go Flex or SHD Studio the question is why use CamillaDSP at all if you are only doing 4 channel output? :)

What multichannel DAC are you considering?

Michael
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
@mdsimon2 , Now I can play from my local lib and CamillaDSP sees the input, but I don't see anything on the output.
I'm still using your M4_streamer.yml config.
Any Ideas?
View attachment 213326

Turn the volume up, it defaults to -40 dB. You can see a smidge of green on the output meters which says something is playing it is just attenuated.

Michael
 

chuckt62

Active Member
Editor
Joined
Apr 6, 2022
Messages
141
Likes
123
Location
Tejas
Well I'm feeling pretty stupid. The android app showed 50% so I didn't mess with it. Once I touched the control, Boom! Now it's working and I can start tinkering with it.
I really appreciate the effort you've put into this thread. It has truly been a colossal effort.
Many Thanks,
Chuck
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,641
Likes
2,251
, heck it will work with any of the Dirac devices with bi-directional USB audio if you can use the USB output of your RPi.
Hm, that is very interesting
I'd probably stay away from the DDRC-22D as I think it is too expensive for what it is
I was eyeing a used one at a reasonable price
go cheap with DDRC-24
If the bidirectional usb thing works, it would be ideal
full featured with the Flex or SHD Studio.
$$$ flex+dirac is either 900 or 1100 eur for me. Studio even more.
What multichannel DAC are you considering?
Wanted to know first if the above was feasible. motu m4 maybe. The goal is to have a way to bring in dirac.

Thanks a lot for the suggestions!
 

dfgoiuj

Member
Joined
Mar 22, 2022
Messages
43
Likes
5
The clock difference can be tiny and often does not cause any glitches within the typical listening time. Or it can be larger and cause glitches quite frequently. CDSP will report the adjusted capture rate with log level set to debug https://github.com/HEnquist/camilla...2e4c99a333d06a57d58c2/src/audiodevice.rs#L615
I enabled rate adjust with adjust period set to 10 and buffer fill level to 0. I also enabled accurate asynchronous resampling with a capture rate of 48000. It seems to have improved things, but I still get the occasional pop or stutter. Strangely, I seem to experience these issues more when playing music than watching movies.
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
I enabled rate adjust with adjust period set to 10 and buffer fill level to 0. I also enabled accurate asynchronous resampling with a capture rate of 48000. It seems to have improved things, but I still get the occasional pop or stutter. Strangely, I seem to experience these issues more when playing music than watching movies.

Have you checked clocking options in alsamixer?

Michael
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
501
Likes
323
Top Bottom