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

1. If you have installed my files in folders, named as in my .tar, you should be able to start everything (squeezelite + camilladsp + samplerate-daemon.py) by executing my start script:
Code:
sudo /opt/camilladsp/cdsp-squeezelite.sh start
. As you said squeezelite configuration is made in the squeezelite-pager on the pCP's webinterface. You set it as you would if running without camilladsp. The output, -o, and the logging, -d -f, options are ignored and hard-coded in my script.
You also need to set the right "playback" parameters in the camillladsp *.yml files. I followed your guide for my initial setup, so it might be fit. If camilladsp fails to load the config, squeezelite also fails, and everything dies.

What have you tried, and do you get any kind of error messages? camilladsp log goes to: /var/log/camilladsp.log. No squeezelite log.

I have been working on the start script and daemon. You can try this new vesion. It has logging options working for both camilladsp and squeezelite. camilladsp log is set by adding options -l -v:
Code:
sudo /opt/camilladsp/cdsp-squeezelite.sh start -l -v
squeezelite logging is now set in the web-page.
 

Attachments

  • cdsp-setup3.zip
    2.2 MB · Views: 100
Oh.. and I forgot. camilladsp is always starting with the config /home/tc/camilladsp/44100.yml. That is actually just a symbolic link to /home/tc/camilladsp/normal/44100.yml, or in my new tar: /home/tc/camilladsp/base/44100.yml. If you run
Code:
ls -l /home/tc/camilladsp
You'll get a nice list telling where all the links go.
You can open either the link or the target with nano for editing. Same, same...
 
Last edited:
Oh.. and I forgot. camilladsp is always starting with the config /home/tc/camilladsp/44100.yml. That is actually just a symbolic link to /home/tc/camilladsp/normal/44100.yml, or in my new tar: /home/tc/camilladsp/base/44100.yml. If you run

tc@piCorePlayer:~$ sudo /opt/camilladsp/camilladsp -v /home/tc/camilladsp/44100.yml
[2020-10-24T05:06:22Z DEBUG camilladsp] Read config file Some("/home/tc/camilladsp/44100.yml")
[2020-10-24T05:06:22Z ERROR camilladsp] Could not open config file '/home/tc/camilladsp/44100.yml'. Error: No such file or directory (os error 2)
[2020-10-24T05:06:22Z DEBUG camilladsp] Exiting due to config error

tc@piCorePlayer:~$ ls -l /home/tc/camilladsp
total 8
lrwxrwxrwx 1 root staff 17 Jan 1 1970 176400.yml -> stol-1/176400.yml
lrwxrwxrwx 1 root staff 17 Jan 1 1970 192000.yml -> stol-1/192000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 24000.yml -> stol-1/24000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 44100.yml -> stol-1/44100.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 48000.yml -> stol-1/48000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 88200.yml -> stol-1/88200.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 96000.yml -> stol-1/96000.yml
drwxr-sr-x 2 tc staff 120 Jan 1 1970 config/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 flat-0dB/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 flat-12dB/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 normal/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 test-1/
drwxr-sr-x 2 tc staff 40 Oct 22 09:29 test-2/

Then i copy'ed the /home/tc/camilladsp/normal/44100.yml into /home/tc/camilladsp :
tc@piCorePlayer:~$ ls -all /home/tc/camilladsp
total 32
drwxr-sr-x 8 tc staff 340 Jan 1 1970 ./
drwxr-s--- 6 tc staff 360 Jan 1 1970 ../
-rw-r--r-- 1 tc staff 591 Oct 24 07:20 176400.yml
-rw-r--r-- 1 tc staff 597 Oct 24 07:20 192000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 24000.yml -> stol-1/24000.yml
-rw-r--r-- 1 tc staff 588 Oct 24 07:11 44100.yml
-rw-r--r-- 1 tc staff 589 Oct 24 07:19 48000.yml
-rw-r--r-- 1 tc staff 589 Oct 24 07:19 88200.yml
-rw-r--r-- 1 tc staff 589 Oct 24 07:19 96000.yml
drwxr-sr-x 2 tc staff 120 Jan 1 1970 config/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 flat-0dB/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 flat-12dB/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 normal/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 test-1/
drwxr-sr-x 2 tc staff 40 Oct 22 09:29 test-2/

And trying to start the script :
tc@piCorePlayer:~$ sudo /opt/camilladsp/cdsp-squeezelite.sh start

Squeezelite is already started by pCP.

Now i just removed the .pid :
tc@piCorePlayer:~$ sudo rm /var/run/squeezelite.pid

And now the script can execute :
sudo /opt/camilladsp/cdsp-squeezelite.sh start

ps aux :

8187 root 0:00 [kworker/3:0-eve]
8205 root 0:02 /usr/local/bin/python3 /opt/camilladsp/samplerate-daemon.py
8206 root 0:01 /usr/local/bin/squeezelite -n Stinout -o - -a 80:4::1: -b 10000 20000 -r 44100 192000 2500 -s 192.168.1.29 -U -U
8207 root 0:00 /opt/camilladsp/camilladsp -v -p 1234 /home/tc/camilladsp/44100.yml

Cool :)

Now i can play 44100 files, but somehow samplerate switching does not work?
I did btw. do excatly what you wrote regarding the unpacking, also it looks like the files are in the right locations.

I will try more and see if i can figure out the problem i have now!

Jesper.
 
Update *!

Somehow the script didn't engage the "-d output=info", so setting it on the pCP webinterface did the trick.

Now samplerate switching is working :):D

So why is the -d output=info not set? - The script you made look's like it should be?
Also i think i will try removing all the files, making a new unpack to see if the weird links in /home/tc/camilladsp are still created, blocking camilladsp from starting.

tc@piCorePlayer:~$ sudo /opt/camilladsp/camilladsp -v /home/tc/camilladsp/44100.yml
[2020-10-24T05:06:22Z DEBUG camilladsp] Read config file Some("/home/tc/camilladsp/44100.yml")
[2020-10-24T05:06:22Z ERROR camilladsp] Could not open config file '/home/tc/camilladsp/44100.yml'. Error: No such file or directory (os error 2)
[2020-10-24T05:06:22Z DEBUG camilladsp] Exiting due to config error

tc@piCorePlayer:~$ ls -l /home/tc/camilladsp
total 8
lrwxrwxrwx 1 root staff 17 Jan 1 1970 176400.yml -> stol-1/176400.yml
lrwxrwxrwx 1 root staff 17 Jan 1 1970 192000.yml -> stol-1/192000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 24000.yml -> stol-1/24000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 44100.yml -> stol-1/44100.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 48000.yml -> stol-1/48000.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 88200.yml -> stol-1/88200.yml
lrwxrwxrwx 1 root staff 16 Jan 1 1970 96000.yml -> stol-1/96000.yml
drwxr-sr-x 2 tc staff 120 Jan 1 1970 config/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 flat-0dB/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 flat-12dB/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 normal/
drwxr-sr-x 2 tc staff 180 Jan 1 1970 test-1/
drwxr-sr-x 2 tc staff 40 Oct 22 09:29 test-2/

Jesper.
 
UPDATE* UPDATE*

pi r... congrats...

The newest cdsp-setup3 you created does create the symlinks correctly.
It also start's squeezelite with the "-d output=info" log enabled now :worship:

So it look's like everything is working.

I changed the script a little to have it removing this stupid squeezelite.pid file :)
nano /opt/camilladsp/cdsp-squeezelite.sh
Code:
# Set DAEMON to the actual binary of squeezelite. Will NOT be run as a daemon!
DAEMON=/usr/local/bin/squeezelite
PIDFILE=/var/run/squeezelite.pid
sqLOGFILE=/var/log/pcp_squeezelite.log

[B][COLOR="DarkGreen"]echo
echo "Checking for existing squeezelite pidfile"
FILE=/var/run/squeezelite.pid
if test -f "$FILE"; then
    echo "$FILE exists."
    echo "Removing $PIDFILE..."
    rm "$PIDFILE"
else
    echo "All good, none squeezelite pidfile"
fi
[/COLOR][/B]
start () {
    echo "+ Starting $DESC..."
    
    # Read from config file
    . /usr/local/etc/pcp/pcp.cfg

    # Check if variable is present then add the correct option in front
    [ x"" != x"$NAME" ]         && NAME="$NAME"                                                 # <--- Moved "-n" to allow for spaces
    [ x"" != x"$OUTPUT" ]       && OUTPUT=" -o $OUTPUT"
    [ x"" != x"$ALSA_PARAMS" ]  && ALSA_PARAMS=" -a "$ALSA_PARAMS""

Next is getting it to start when pCP boot's!

Jesper.
 
Damn..! It's so hard to get all pieces right... The "weird links" is my mistake. Sorry... :sorry:
The solution is either as you planed, to use the new tare, and hope that I didn' repeat my mistake (I didn't). Or to remove all the links/files /home/tc/camilladsp*.yml (not the sub-folder), and then run my script to select config ans append the wanted config folder-name, like:
Code:
/opt/camilladsp/select-config.sh base
That will set all the links to selected folder, and trigger camilladsp to reload.
I'm puzzled about the missing "-d" and "-f" options for the start of squeezelite..? But if it works in the latest version, I'll think it's case closed...

I don't think you should just remove the squeezelite pid-file. Not without checking if squeezelite is actually running first. I was lazy and reused pCP's code to check if it is running, before I start another one. I should ignore the pid-file and look for a running squeezelite process. However, this shouldn't be a problem, as long as you stop squeezelite the proper way - in the web-interface.

To make it start at boot: Add this in the end of your original /opt/bootlocal.sh:
Code:
# Start: squeezelite + CamillaDSP + camilladsp_reload_cfg.py daemon
sudo /opt/camilladsp/cdsp-squeezelite.sh start -l >> /var/log/bootlocal.log &
/opt/camilladsp/cdsp-squeezelite.sh status >> /var/log/bootlocal.log &
Maybe you also noted that he new .tar added another new folder: /home/tc/bin with some file?
It's a convenience feature. That is actually also a symboilic link, pointing to the hidden folder /home/tc/.local/bin. That folder is normally included in the system PATH, so any script located there can be executed without giving the full path. I added links to all my scripts in /opt/camilladsp. So they can all be run conveniently... :)
 
Hm... I'm not sure about what you are asking...
That is basically what I have done in my device. I dont know if it's a good idea to integrate it altogether, but it might be possible.

I forgot to mention in my last post, about starting at boot:
You have to disable pCP from starting squeezelite at boot
, on the "Tweaks" web-page, in the "Audio tweaks" section.
 
Damn..! It's so hard to get all pieces right... The "weird links" is my mistake. Sorry... :sorry:
The solution is either as you planed, to use the new tare, and hope that I didn' repeat my mistake (I didn't). Or to remove all the links/files /home/tc/camilladsp*.yml (not the sub-folder), and then run my script to select config ans append the wanted config folder-name, like:
Code:
/opt/camilladsp/select-config.sh base
That will set all the links to selected folder, and trigger camilladsp to reload.
I'm puzzled about the missing "-d" and "-f" options for the start of squeezelite..? But if it works in the latest version, I'll think it's case closed...

I don't think you should just remove the squeezelite pid-file. Not without checking if squeezelite is actually running first. I was lazy and reused pCP's code to check if it is running, before I start another one. I should ignore the pid-file and look for a running squeezelite process. However, this shouldn't be a problem, as long as you stop squeezelite the proper way - in the web-interface.

To make it start at boot: Add this in the end of your original /opt/bootlocal.sh:
Code:
# Start: squeezelite + CamillaDSP + camilladsp_reload_cfg.py daemon
sudo /opt/camilladsp/cdsp-squeezelite.sh start -l >> /var/log/bootlocal.log &
/opt/camilladsp/cdsp-squeezelite.sh status >> /var/log/bootlocal.log &
Maybe you also noted that he new .tar added another new folder: /home/tc/bin with some file?
It's a convenience feature. That is actually also a symboilic link, pointing to the hidden folder /home/tc/.local/bin. That folder is normally included in the system PATH, so any script located there can be executed without giving the full path. I added links to all my scripts in /opt/camilladsp. So they can all be run conveniently... :)

Hey...

My testrig is booting, loading all the excellent script's now pi r :cheers:

IMO this setup is much better than my own hacked squeezelite, also the use of the original and maintained squeezelite is preferred... BIG thank's man :)

Regarding the killing/removing of the pidfile, is a working fix for now, i can easily live with that :D

Do you plan to write a guide howto get this going, I mean if it should be i think it's important that the upgrading to the CamillaGUI is good to have.
You can steal whatever you like from my github, but we could also rewrite (when the testing is done ofcause!!!) my hole SuperPlayer guide, or perhaps create a new git with a fu**** fancy name :):):) ...

Think about it pi r!
- Good day, and take care man!

Jesper
 
Hm... I'm not sure about what you are asking...
That is basically what I have done in my device. I dont know if it's a good idea to integrate it altogether, but it might be possible.

I forgot to mention in my last post, about starting at boot:
You have to disable pCP from starting squeezelite at boot
, on the "Tweaks" web-page, in the "Audio tweaks" section.

Okay... please reject this post about replacing the squeezelite init script.

I will try to remove my pidfile hack and stop squeezelite from being started at boot.

Jesper.
 
My goal have been to get somethig that easily can be implemented on a standard pCP. And I think we have that now.
Further I was hoping for you to add the GUI for camilladsp to make the "complete packet". I don't have a GitHub repo, so I think you can put it on yours.

A new fancy name? How about: "PoS" - piCorePlayer on Steroids.
But it's really just an implementation of CamillaDSP on a pCP, so that's maybe what it should be called: "CamillaDSP on pCP"

And now to the most important...
Have you done any listening yet..? :scratch2:

This setup do have an (important?) advantage. We got rid of the previous use of the alsa loopback device. If I understand anything right, this means that we now can have a proper software volume control in the end of the chain, the DAC - if that is what you want (and I do...).
(on the CamillaDSP tread)
 
Hey ...

pi r, i fully agree.

I think we should call it something like PoS or CamillaDSP on pCP.
I will as i said like to write a complete new guide, when testing is done ofcause; and no i didn't do any real listning as of yet :)... Hope to do so real soon, just have to implement this new setup on my main stereo first, but that should be easy enough.

This setup do have an (important?) advantage. We got rid of the previous use of the alsa loopback device. If I understand anything right, this means that we now can have a proper software volume control in the end of the chain, the DAC - if that is what you want (and I do...).
btw.: how does your'e /etc/asound.conf look like?

Jesper.
 
My asound.conf is to crowded for this setup, to be a good example... :boggled:
The only part of it that is active is the pcm and ctl "sound_out" sections that I got from your GitHub guide. I wiped the original file, but hopefully it might do as is..?

I'm just about to start making a new clean installation from a fresh pCP image. I want to check that there are no trickery needed from your GitHub guide, or my later experiments.
My plan is to do minimal changes to a default install. I'm split about to disable the Rpi onboard analog audio. It could be nice to have a possible alternative for testing, and emergency.

@ Henrik:
The first one, Point of Sales, is familiar to me, but the second one wasn't... doesn't sound good at all. Scrap that suggestion. Or maybe we could go ironic... :devilr:

Graphics to the Rpi would be great..! The gui doesn't seem to have very much to offer without it - but a lot with it. I haven't tried it yet, so maybe I'm mistaken. I'm patiently waiting for Jesper to make up another brilliant installation guide...:)
 
Last edited: