• 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

dfgoiuj

Member
Joined
Mar 22, 2022
Messages
43
Likes
5
Then it would seem that your pops are not from buffer underruns and adjusting the CamillaDSP buffer will not solve your issue. In that case it seems that it is either a clock sync issue between your TOSLINK card and your source or your TOSLINK card and your DAC.

I would try to use the USB input of your DAC and see if that solves your issue as the DAC will no longer be reliant on the recovered TOSLINK clock.

Michael
Ah yes, I'll give that a go. I wonder if I can drop the ICUSBAUDIO7 altogether and make use of the Hifiberry Digi+ I/O that's sitting there doing nothing. I read that it can't detect sample rates, but my TV only outputs 48000 anyway, so perhaps it's an option for input only and I could use the Topping E30 in USB mode.
 

phofman

Senior Member
Joined
Apr 13, 2021
Messages
489
Likes
319
I am trying to understand how the adjust_period fits into this. I understand that this is the time delay between CDSP checking the input rate to see if adjustment is required, but I'm not sure how to figure out the optimal period, or what the consequence of checking too frequently or too infrequently would be. I imagine that it's probably something to do with target_level vs sample rate. I've not had much luck setting shorter or longer periods; I get popping regardless.
The adjust_period tells CDSP how often it should take the average diff (depicted in the image above, the average gets updated every playback cycle = chunk output), calculate from it the adjusted capture rate and update the capture pace, and reset the diff averager. Therefore longer adjust_period times cause less variation in the feedback rate (longer averating the diff), but cause less responsive feedback. For setups with larger rate diffs the time could be too long and buffer over/underflows could occur. IMO the default 10 secs is OK.

As Michael writes, it's perfectly possible your dropouts are caused by other parts of your chain. Generally this problem is quite tedious to diagnose, as you need to go step by step through your chain and check the signal for dropouts. I did that recently for a similar chain (not involving CDSP, but the very same problem of occasional dropouts).

The method I use is recording a single digital tone at various points of the chain and checking a spectrogram generated by sox. The advantage is that a single picture of many minutes of audio data reveals a single missed/incorrect sample, e.g. like this (a different investigation case, analog signal was involved):

1656052592709.png


If you want to delve into such troubleshooting, we can discuss it (likely in a different thread). It takes a bit of patience and lots of time as the recordings must be long to catch the glitches.
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,199
I believe his issue is more pops and clicks than dropouts.
 

phofman

Senior Member
Joined
Apr 13, 2021
Messages
489
Likes
319
Actually what is the difference? Really, I do not know.

In most cases the problem is caused by dropped/missed/overwritten samples somewhere within the chain.
 
  • Like
Reactions: MCH

Dgob

Active Member
Joined
Mar 29, 2021
Messages
247
Likes
233
Location
England, UK
Hi All,

Old dog, new tricks and all that: I'm hoping to come into the 21st Century and start streaming. To this end, I've taken out life subscription with Roon and subscribed to Tidal.

I've then purchased a Raspberry Pi 4 and a 7" touchscreen to run them on. The RPi4 was a kit with preset sd card onto which I have tried to load Ropieee using echer. That is as far as I have got and now need help to set things up properly.

I'm using a Holo Audio Spring 3 KTE dac and have made my Dell laptop the chore for Roon. I would also like to be able to load HQ Player in order to allow me to over-sample.

Can anyone advise/assist me in this task? I am from the vinyl generation and so baby steps are needed when helping me to enter (or, advance) in the technological and streaming world.

Any help/advice warmly received.
 

Elfsberg

Member
Joined
Feb 14, 2022
Messages
50
Likes
26
Location
Sweden, Falun

dfgoiuj

Member
Joined
Mar 22, 2022
Messages
43
Likes
5
IIRC those devices run at USB2.0, but support only fullspeed (i.e. 12Mbps). Still the dwc2 SoC USB controller is being used, likely causing the glitches, good catch.

@dfgoiuj Can you try the dwc_otg driver, optionally with the performance options at https://github.com/raspberrypi/linux/issues/2215#issuecomment-350449985 ?
From what I could tell from that thread, I had to add 'dwc_otg.speed=1' to the boot/cmdline.txt file. That file didn't exist, so I created it and added the line, then rebooted. I don't think it worked, as iperf revealed ethernet had over 90Mbit/s of bandwidth, when I understood that this should be reduced when restricting to USB 1.1.

When you mention a driver, I guess there's another step here?
 

ezublab

Member
Joined
Jun 28, 2020
Messages
42
Likes
31
Huge gratitude for your kind assistance, I'll get onto trying it out as soon as I return home next week.
Volumio with the plugin FusionDsp make the use of CamillaDsp very easy, with different modes such as graphics Eq, parametric EQ, convolution filters, loudness, crossfeed and so on.
 

Rosensrauk

New Member
Joined
Jul 6, 2022
Messages
2
Likes
0
Hi forum members!
I'm looking for help with setting up a SBC (raspberry pi 4 Linux Debian 5.19.0rc2-v8Fritz+
) as a DSP with theese peripherals:
Usb UAC2Gadget
HDMI 7.1 DAC.

I'm having a hard time getting a tutorial to work: https://github.com/Wang-Yue/CamillaDSP-Gadget.
I have a couple of questions:
1. How to compile CamillaDSP V1.1 as per the tutorial linked? I have a successful v1.0 build.
2. As for capturing the stream, UAC2Gadget or ALSA loop?
3. I'm going to use the DSP for music and video. How to resample everything to a fixed sample rate in order to use a static latency for lip synchronization?
4. After setting up UAC2Gadget my Coreelec gives me two alternatives:
ALSA: Linux USB Audio Gadget Analog
ALSA: Linux USB Audio Gadget, S/PDIF
which should i choose for HDMI?

I would really appreciate any kind of help.
/Fritz
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Hi forum members!
I'm looking for help with setting up a SBC (raspberry pi 4 Linux Debian 5.19.0rc2-v8Fritz+
) as a DSP with theese peripherals:
Usb UAC2Gadget
HDMI 7.1 DAC.

I'm having a hard time getting a tutorial to work: https://github.com/Wang-Yue/CamillaDSP-Gadget.
I have a couple of questions:
1. How to compile CamillaDSP V1.1 as per the tutorial linked? I have a successful v1.0 build.
2. As for capturing the stream, UAC2Gadget or ALSA loop?
3. I'm going to use the DSP for music and video. How to resample everything to a fixed sample rate in order to use a static latency for lip synchronization?
4. After setting up UAC2Gadget my Coreelec gives me two alternatives:
ALSA: Linux USB Audio Gadget Analog
ALSA: Linux USB Audio Gadget, S/PDIF
which should i choose for HDMI?

I would really appreciate any kind of help.
/Fritz

This post has instructions for compiling 1.1 -> https://www.audiosciencereview.com/...sb-source-ipad-and-usb-dac.25414/post-1180356. I am not a gadget user so cannot comment much beyond that.

Michael
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,199
Hi Michael, all,
I would like to add a "mute" function to the flirc remote setup.
I have absolutely no cue about how to write anything in python, but was thinking, looking at the document.... If I add something like:


if attrib.keystate == 1:
if attrib.keycode == 'KEY_LEFT':
if cdspvolume -1 >= -99:
cdsp.set_volume(-99) ??
cdspvolume = cdsp.get_volume()
else:
cdsp.set_volume(-99)
cdspvolume = cdsp.get_volume()

But now the question is.... How to return to the previous volume setting pressing again "left"?

Alternatively, I see camilladsp does have a mute button. Is it possible to call it directly with the flirc?

Thanks for your help.
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
I think I would use the CamillaDSP mute functionality because it seems like it will give you the desired functionality of returning to the old volume after unmuting and would be rather universal even if you are using the GUI. Here is the documentation from the pycamilladsp github.

1657206969364.png


Should be simple enough to assign a FLIRC button to mute and have that run cdsp.get_mute() to see the current mute status, then if cdsp.get_mute() = true use cdsp.set_mute(false) to unmute and if cdsp.get_mute() = false use cdsp.set_mute(true) to mute.

I think it would be nice to have the numerical volume on the display replaced with some indication that you are muted.

Michael
 
  • Like
Reactions: MCH

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,199
Cool, thanks, that's perfect. Actually as all my amplifiers work on signal sense, the mute will double as on/off button from now on.

Hm, regarding the display...
What happens if you press one of the volume buttons while on mute?
If it stays in mute anyways, then you really need a mute symbol on the display. I didn't think of that by the way, now i finally have a reason to assemble it :D
 

phofman

Senior Member
Joined
Apr 13, 2021
Messages
489
Likes
319
Hi forum members!
I'm looking for help with setting up a SBC (raspberry pi 4 Linux Debian 5.19.0rc2-v8Fritz+
) as a DSP with theese peripherals:
Usb UAC2Gadget
HDMI 7.1 DAC.

I'm having a hard time getting a tutorial to work: https://github.com/Wang-Yue/CamillaDSP-Gadget.
IIUC that tutorial as is does not output to HDMI, but to a USB audio device. You will have to make modifications which requires some basic background on the overall setup and how parts of the setup work together.

2. As for capturing the stream, UAC2Gadget or ALSA loop?
See above - what would you use the loopback device for?
3. I'm going to use the DSP for music and video. How to resample everything to a fixed sample rate in order to use a static latency for lip synchronization?
I am not sure the whole chain is directly capable of consistently fixed latency for AV sync. But maybe the latency will end up stable enough, just test it out.

4. After setting up UAC2Gadget my Coreelec gives me two alternatives:
ALSA: Linux USB Audio Gadget Analog
ALSA: Linux USB Audio Gadget, S/PDIF
which should i choose for HDMI?
IIUC your Coreelec is the USB host. The two devices are offered because alsa by default generates multiple PCM devices (as listed by aplay -L) for each soundcard device (as listed by aplay -l). Just pick the first. Please note that this selection has no effect on what output device CDSP running on the USB gadget actually uses - again related to my first note.

I would recommend to start step by step, working from the end of the chain (working 7.1 HDMI sink) item by item all the way up to the player. It does require some linux audio and RPi-specific knowledge.
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Cool, thanks, that's perfect. Actually as all my amplifiers work on signal sense, the mute will double as on/off button from now on.

Hm, regarding the display...
What happens if you press one of the volume buttons while on mute?
If it stays in mute anyways, then you really need a mute symbol on the display. I didn't think of that by the way, now i finally have a reason to assemble it :D

Good question, it shows -99 when I hit mute and if I press a volume button while in mute or unclick mute in the GUI it goes back to the previous volume level.

I guess I really don't need to do anything to the display (maybe a future project I guess).

Michael
 
  • Like
Reactions: MCH
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
I added mute functionality to flirc.py last night (see attached). It was a bit different than using the GUI mute because it didn't return to the previous volume when using cdsp.set_mute(). As a result I store the volume at time of mute and then revert to that when unmuted or if the volume is increased. Mute button is key left.

I think I will work towards having some sort of mute indication as I don't particularly like the behavior of the volume showing -99 and not knowing if the next volume increase will go to -98 or the previous setting. I think the way that the Okto does it is best, there is mute indication and if you change the volume while muted it shows the change on the display but doesn't remove the mute. Once you unmute it will go to whatever the volume is on the display.

Michael
 

Attachments

  • flirc_07072022.txt
    3.3 KB · Views: 52
Top Bottom