SuperPlayer - The DSP_Engine (CamillaDSP) samplerate switching & ESP32 remote control

@pi r.

First off... I send you a PM.

Well regarding the hacking of the script, i see that having numbers and letters before and after the [samplerate], gives some challenges.
This little hack i did only works for my setup i see, and i think if we should change anything it should be bulletproof :)... Agreed !

One quistion! Am i right that there must be at least one file called 44100.yml linked to the "real" filter .yml for it to start at boot?

So except the idea of integration it into the pCP, do you agree with the rest of the stuff i suggested pi r?

Jesper.
 
Just a hint - you might want to consider using $(command) instead of the old-time `command` constructs. Text auto-formatting tools frequently replace trailing back quotes with regular quotes (just what happened in the code snippet above), back quotes are easy to overlook, and they are often quite hard to find/write on international keyboards.

And a note learned by decades of living with bash scripts - bash scripts get easily very complicated and difficult to debug. Sometimes (if the environment allows) it is faster, more reliable, and especially more comfortable to write a complicated feature in python, with its proper debugging, simple text parsing (no grep pipelines), advanced structures (dicts, lists, queues etc.) available. The move to python brings no advantage for simple bash scripts but these tend to accumulate ugly code in time if a more complicated task is to be solved.
 
.../
One quistion! Am i right that there must be at least one file called 44100.yml linked to the "real" filter .yml for it to start at boot?
.../
Yes - correct.
CamillaDSP must be started with a valid .yml config file in the command line to be able to start. I expect "everyone" will need a 44100.yml file, so I picked that one. It doesn't mater if it's a link or a real file.
 
@ phofman:
Thanks for your hints. Appreciated..!
I have been reluctant over which syntax to use. I just picked the one that looked simpler... didn't know it was the "old style".

As for bash vs python, etc...
I don't have the experience to even have an opinion... advanced scripting is for others, regardless of language. I'll stick to simple ones. I have to struggle with them too...
 
@pi r
I tried to modify the startup command for squeezelite to add a tee so as to also send squeezelite output to a file to debug pops. This was suggested by @Henrik.

I first tried to set the string OTHER in pcp.cfg to "| tee somefile.out" but that threw a syntax error.

I then tried to directly launch squeezelite using this command directly from terminal :

/usr/bin/squeezelite -n DietPi -o - -a 160:4::1: -b 10000 20000 -r 44100 192000 2500 -U -U -d output info -f /var/run/squeezelite-log.fifo | tee somefile.out

Once again I got a syntax error. Any idea how to best achieve the desired outcome with your setup?

BTW why are there multiple -U in your squeezelite start command?
 
Change
-d output info
to
-d output=info
From the help screen:
Code:
  -d <log>=<level>    Set logging level, logs: all|slimproto|stream|decode|output|ir, level: info|debug|sdebug
You can just remove the dual "-U" options. They are a mistake, and a heritage from lykkedks first setup. That option is ment to set a volume control device.
From the help screen:
Code:
 -U <control>        Unmute ALSA control and set to full volume
Without giving a device name for <control>, it does nothing. Not even if used twice... :tongue:

Edit:
I removed a comment about my squeezelite options config that was plain wrong. It doesn't work with sample rate switching.
 
Last edited:
This is the exact command that starts my squeezelite + camilladsp:
Code:
/usr/local/bin/squeezelite -n SqueezePi2 -o - -a :::: -r 24000-384000 -s 192.168.1.5 -v -d output=info -f /var/run/squeezelite-log.fifo | /opt/camilladsp/camilladsp  -p 1234 /home/tc/camilladsp/44100.yml > /dev/null 2>&1 &
I have nearly zero experience wit tee. Can you put it in between, squeezelite and camilladsp like this?
Code:
/usr/local/bin/squeezelite -n SqueezePi2 -o - -a :::: -r 24000-384000 -s 192.168.1.5 -v -d output=info -f /var/run/squeezelite-log.fifo | tee [some_file] | /opt/camilladsp/camilladsp  -p 1234 /home/tc/camilladsp/44100.yml > /dev/null 2>&1 &
 
My guess was right.
This works, and sends the audio stream to the file: /var/log/squeezelite_audio.dat, while playing through camilladsp.

Code:
/usr/local/bin/squeezelite -n SqueezePi2 -o - -a :::: -r 24000-384000 -s 192.168.1.5 -v -d output=info -f /var/run/squeezelite-log.fifo | tee /var/log/squeezelite_audio.dat | /opt/camilladsp/camilladsp  -p 1234 /home/tc/camilladsp/44100.yml > /var/log/camilladsp.log 2>&1 &
 
OK its confirmed now that the pops are coming out of squeezelite. Thanks for your help @pi r

The code blocked screwed up things again but this is the exact command I used :

/usr/bin/squeezelite -n DietPie -o - -a 160:4::1 -b 10000:20000 -r 44100-192000:2500 -s 192.168.0.16 -v -d output=info -f /var/run/squeezelite-log.fifo | tee /var/log/squeezelite_audio.dat | /opt/camilladsp/camilladsp -p 1234 /home/tc/camilladsp/44100.yml > /var/log/camilladsp.log 2>&1 &

Now to try and work out why this is so.
 
Thanks @pi r! Problem solved. Looking at the "all=debug"... provided the clue. I have an old Squeezebox Touch which I sync to the DietPi/Camilla player on my RPI4. I do this just to display current track playing and so the Touch IR remote can still control playback. Looking closely the log showed frequent frame skips with player sync on. Turning off player sync eliminated the pops. There is a player setting in LMS called "Don't maintain synchronization". With this setting I can still have both players synchronized in LMS with no pops now. Not sure why this issue doesn't occur with Jespers setup though.
 
Perhaps "enable_rate_adjust: true" with Jesper's..?

I had problems with pops in the piped setup before I turned it off. Maybe you could try to turn it on with synchronized players? But I suppose that would make your SB Touch to be the master, and not the DietPi...

Don't know if/how that can be controlled in LME. The player that gets the start command gets to be master..?
 

TNT

Member
Joined 2003
Paid Member
Thanks @pi r! Problem solved. Looking at the "all=debug"... provided the clue. I have an old Squeezebox Touch which I sync to the DietPi/Camilla player on my RPI4. I do this just to display current track playing and so the Touch IR remote can still control playback. Looking closely the log showed frequent frame skips with player sync on. Turning off player sync eliminated the pops. There is a player setting in LMS called "Don't maintain synchronization". With this setting I can still have both players synchronized in LMS with no pops now. Not sure why this issue doesn't occur with Jespers setup though.

I had this too.

I wish there was a way to make Squeezelite (or similar MLS based player) had a setting to choose output device or even to be a visible sound resource that can connect to at least Soundflower but even better if could be recognised as a Capture Device (?).

//
 

TNT

Member
Joined 2003
Paid Member
As of now I have to set system sound output to Soundflower and let the Mac OS handle the sound... meaning that the general laptop sound level out control is effecting the sound. I wish to leave out the sound handling from the OS as much as possible...

//
 
Perhaps "enable_rate_adjust: true" with Jesper's..?

I had problems with pops in the piped setup before I turned it off. Maybe you could try to turn it on with synchronized players? But I suppose that would make your SB Touch to be the master, and not the DietPi...

Don't know if/how that can be controlled in LME. The player that gets the start command gets to be master..?

I tried enabling rate adjust before but it didn't help. In any case I may revisit PCP again soon now everything is working with it.
 
NEWS...

Hello.

I've been working on seashell's setup for the piCorePlayer lately.
Eventhrough i tested it on two Pi's i need someone brave to try it out!

It should work.
NOTE : my .TCZ repo. is on SourceForge, as of writing i'am trying to get it working on Git, but so far with no luck.

Find it here :GitHub - Lykkedk/cdsp-samplerate-control: SuperPlayer CamillaDSP SampleRate Control Setup's

Read the guide an do a one liner :
Code:
tce-load -wi python3.6 && pcp-load -u [url=https://sourceforge.net/projects/cdsp-samplerate-control/files/10.x/armv7/tcz]cdsp_samplerate_control -  Browse /10.x/armv7/tcz at SourceForge.net[/url] -wi seashell_alsa.tcz

Jesper.