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

Dear All,


Please find output below:


tc@piCorePlayer:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Tone1 [Tone1], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
tc@piCorePlayer:~$ cat /home/tc/camilladsp/44100.yml

devices:
samplerate: 44100
chunksize: 4096
queuelimit: 1

capture:
type: File
channels: 2
filename: /dev/stdin
format: S32LE
playback:
type: Alsa
channels: 2
device: "hw:0,0"
format: S16LE

filters:
clipgain:
type: Gain
parameters:
gain: 0.0
inverted: false

Baseboost:
type: Biquad
parameters:
type: Highshelf
freq: 80
gain: -6
slope: 6

pipeline:
- type: Filter
channel: 0
names:
- clipgain
- Baseboost
- type: Filter
channel: 1
names:
- clipgain
- Baseboost


Many thanks!
 
Fra8123::

Maybe you can try the command Henrik suggested, and then maybe try to change the parameters marked in BOLD & RED below ::

Test with the commands i suggested yesterday ::

Code:
sudo squeezelite-cdsp.sh stop
/usr/local/bin/camilladsp /home/tc/camilladsp/44100.yml -vv -p 1234

Change parameters and rerun
Code:
/usr/local/bin/camilladsp /home/tc/camilladsp/44100.yml -vv -p 1234

Until no Error's!...
Good luck :p

capture:
type: File
channels: 2
filename: /dev/stdin
format: S32LE
playback:
type: Alsa
channels: 2
device: "hw:0,0"
format: S16LE

Jesper.
 
Hi Jesper,


Some good news, I have changed S32LE in playback as well and now it is better. Actually my DAC is working 24 or 32 bit. My apologies for my mistake.



Output below:

tc@piCorePlayer:~$ /usr/local/bin/camilladsp /home/tc/camilladsp/44100.yml -vv -p 1234
2021-01-29 12:06:37.288 DEBUG camilladsp - Read config file Some("/home/tc/camilladsp/44100.yml")
2021-01-29 12:06:37.289 DEBUG camillalib::biquad - a1=-1.9806297 a2=0.98072064 b0=0.5031917 b1=-0.9926435 b2=0.48954293
2021-01-29 12:06:37.289 DEBUG camillalib::biquad - a1=-1.9806297 a2=0.98072064 b0=0.5031917 b1=-0.9926435 b2=0.48954293
2021-01-29 12:06:37.289 DEBUG camilladsp - Config is valid
2021-01-29 12:06:37.289 DEBUG camillalib::socketserver - Start websocket server on 127.0.0.1:1234
2021-01-29 12:06:37.290 DEBUG camilladsp - Wait for config
2021-01-29 12:06:37.290 DEBUG camilladsp - Config ready
2021-01-29 12:06:37.290 DEBUG camillalib::filters - Build new pipeline
2021-01-29 12:06:37.290 DEBUG camillalib::filters - Build from config
2021-01-29 12:06:37.291 DEBUG camillalib::biquad - a1=-1.9806297 a2=0.98072064 b0=0.5031917 b1=-0.9926435 b2=0.48954293
2021-01-29 12:06:37.291 DEBUG camillalib::filters - Build from config
2021-01-29 12:06:37.291 DEBUG camillalib::biquad - a1=-1.9806297 a2=0.98072064 b0=0.5031917 b1=-0.9926435 b2=0.48954293
2021-01-29 12:06:37.291 DEBUG camillalib::processing - build filters, waiting to start processing loop
2021-01-29 12:06:37.291 DEBUG camilladsp - Capture thread ready to start
2021-01-29 12:06:37.297 DEBUG camillalib::alsadevice - Opening audio device "hw:0,0" with parameters: HwParams { channels: Ok(2), rate: "Ok(44100) Hz", format: Ok(S32LE), access: Ok(RWInterleaved), period_size: "Ok(1024) frames", buffer_size: "Ok(8192) frames" }, SwParams(avail_min: Ok(1024) frames, start_threshold: Ok(3072) frames, stop_threshold: Ok(8192) frames)
2021-01-29 12:06:37.298 DEBUG camillalib::alsadevice - Audio device "hw:0,0" successfully opened
2021-01-29 12:06:37.298 DEBUG camilladsp - Playback thread ready to start
2021-01-29 12:06:37.298 DEBUG camilladsp - Both capture and playback ready, release barrier
2021-01-29 12:06:37.298 DEBUG camillalib::filedevice - starting captureloop
2021-01-29 12:06:37.298 DEBUG camillalib::filedevice - starting captureloop
2021-01-29 12:06:37.298 DEBUG camillalib::alsadevice - Starting playback loop



Once done I run the commands:
sudo /home/tc/StartServer.sh

sudo /usr/local/bin/squeezelite-cdsp.sh start &

sudo filetool.sh -b


The good new is that it worked until the reboot. After the reboot it is unfortunately giving again the same error as before and it does not want to work.


I still strongly suggest that the best way is to rerun the commands of the amended guide, in order to remove any doubt users do something wrong or with the wrong order.


Thank you so much!!
 
Hi... very good new's...

The good new is that it worked until the reboot. After the reboot it is unfortunately giving again the same error as before and it does not want to work.

You need to have two lines executed at boot to start all the stuff automatically...

Edit the /opt/bootlocal.sh file to include the two lines in BOLD ::

Code:
#!/bin/sh
# put other system startup commands here

GREEN="$(echo -e '\033[1;32m')"

echo
echo "${GREEN}Running bootlocal.sh..."
#pCPstart------
/usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log
#pCPstop------

[B]/home/tc/StartServer.sh
sudo /usr/local/bin/squeezelite-cdsp.sh start &[/B]

And then execute
Code:
sudo filetool.sh -b && sudo reboot

Then everything should work as expected...

Jesper.
 
Fra8123...

Remember to disable squeezelite at boot in pCP webinterface :)

Jesper.


Hi Jesper,


As you know squeezelite is disabled in the pCP web interfaced, you asked me to do one week ago (Audio tweaks ->Squeezelite -> No).


Furthermore, as for the guide I edited the file when I did the procedure two weeks ago:

#!/bin/sh # put other system startup commands here GREEN="$(echo -e '\033[1;32m')" echo echo "${GREEN}Running bootlocal.sh..." #pCPstart------ /usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log #pCPstop------ /home/tc/StartServer.sh sudo /usr/local/bin/squeezelite-cdsp.sh start &


But it is still not working :Ohno:. It should be another problem :confused:.



Kind Regards.
 
Fra8123... We are close now...

So if try to reboot the Pi, can you try to execute ::

Code:
ps aux | grep main.py

This should give the output, if the GUI (Webinterface is running) ::
tc@TestRig:~$ ps aux | grep main.py
8493 tc 0:01 /usr/local/bin/python3 /mnt/mmcblk0p2/tce/Camilla_Extensions/camillagui/main.py
15736 tc 0:00 grep main.py


Let's confirm that this is started at boot? --- If it's running try next step ::

Code:
sudo squeezelite-cdsp.sh status
When it's running it gives the output ::

Running processes:
PID User ELAPSED CPU Command
15880 root 0:42 0:00 /usr/local/bin/python3 /usr/local/bin/samplerate-daemon.py
15881 root 0:42 0:01 /usr/local/bin/squeezelite -n SuperPlayer_TestRig -o - -a 160:4::1: -b 10000 20000 -s 192.168.1.29 -U -U -d output info -f /var/run/squeezelite-log.fifo
15882 root 0:42 0:01 /usr/local/bin/camilladsp /home/tc/camilladsp/44100.yml -p 1234 -g-3 -l off

Try it..

Jesper.
 
Hi Jesper,


Almost there...and I am doing baby steps bur close. After the reboot, in order to make it works I have to rerun, for a strange reason, the commands:


sudo /usr/local/bin/squeezelite-cdsp.sh start &


sudo /home/tc/StartServer.sh


So, please find below the output before running the commands above:


tc@piCorePlayer:~$ cat /opt/bootlocal.sh
#!/bin/sh
# put other system startup commands here

GREEN="$(echo -e '\033[1;32m')"

echo
echo "${GREEN}Running bootlocal.sh..."
#pCPstart------
/usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log
#pCPstop------

/home/tc/StartServer.sh
sudo /usr/local/bin/squeezelite-cdsp.sh start &



-----------------------------------------------------------------------------------



tc@piCorePlayer:~$ ps aux | grep main.py
8528 tc 0:00 grep main.py
tc@piCorePlayer:~$ sudo squeezelite-cdsp.sh status

Squeezelite player and CamillaDSP is not running.


-----------------------------------------------------------------------------------



Output after running the commands:



tc@piCorePlayer:~$ sudo /usr/local/bin/squeezelite-cdsp.sh start
+ Starting Squeezelite player and CamillaDSP...
+ Starting daemon /usr/local/bin/samplerate-daemon.py
tc@piCorePlayer:~$ sudo /home/tc/StartServer.sh
tc@piCorePlayer:~$ {'camilla_host': '0.0.0.0', 'camilla_port': 1234, 'port': 5000, 'config_dir': '/home/tc/camilladsp/configs', 'coeff_dir': '/home/tc/camilladsp/coeffs'}
No plotting!
======== Running on http://0.0.0.0:5000 ========
(Press CTRL+C to quit)
^C
tc@piCorePlayer:~$ ps aux | grep main.py
8553 tc 0:01 /usr/local/bin/python3 /mnt/mmcblk0p2/tce/Camilla_Extensions/camillagui/main.py
8559 tc 0:00 grep main.py
tc@piCorePlayer:~$ sudo squeezelite-cdsp.sh status

Running processes:
PID User ELAPSED CPU Command
8538 root 0:28 0:01 /usr/local/bin/python3 /usr/local/bin/samplerate-daemon.py
8539 root 0:28 0:00 /usr/local/bin/squeezelite -n piCorePlayer -o - -a 80:4::1 -d output info -f /var/run/squeezelite-log.fifo
8540 root 0:28 0:00 /usr/local/bin/camilladsp /home/tc/camilladsp/44100.yml -p 1234 -g-3 -l off
------------------------------------------------------------------------------------


It is working fine until the reboot.



For some strange reason the autoboot is not working. What could the issue be?


Many thanks:up::up::up:!!!!
 
Okay...

When you start by hand the squeezelite-cdsp.sh, use this command ::
Code:
sudo /usr/local/bin/squeezelite-cdsp.sh start
Not this one here ::
Code:
sudo /usr/local/bin/squeezelite-cdsp.sh start &
It is only used in /opt/bootlocal.sh

Soo... I'am thinking :)


My mistake, it is just a type error:


I always used the code:


sudo /usr/local/bin/squeezelite-cdsp.sh start



without &.



The issue should be another :confused:
 
Okay Fra...

Can you comment [#] out the line in /opt/bootlocal.sh

#!/bin/sh
# put other system startup commands here

GREEN="$(echo -e '\033[1;32m')"

echo
echo "${GREEN}Running bootlocal.sh..."
#pCPstart------
/usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log
#pCPstop------

/home/tc/StartServer.sh
#sudo /usr/local/bin/squeezelite-cdsp.sh start &

Code:
sudo filetool.sh -b && sudo reboot

Then see if webinterface is running
Code:
ps aux | grep main.py

This will confirm if we can make the webinterface run at boot at least.

If it's running try to start the rest...
Code:
sudo /usr/local/bin/squeezelite-cdsp.sh start

:)

Jesper.
 
@ Jesper:
I think there is something fishy about the /home/tc/StartServer.sh script. When Fra8123 runs it manually, it doesn't finish and return to prompt. It waits for "CTRL+C to quit". That will cause a problem when the script runs on boot (form bootlocal.sh).
But - the script shouldn't act like that with a command ending with a "&" like you do (from your GitHub):
Code:
#!/bin/sh
# Script to start the CamillaDSP server  192.168.1.XX:5000 (with correct IP address)

su tc -c "/usr/local/bin/python3 /mnt/mmcblk0p2/tce/Camilla_Extensions/camillagui/main.py" &

exit
I haven't installed or tested this myself, and my only gess is that it is the "su" command that don't work with a trailing "&".
Maybe it works if you add a trailing "&" in /opt/bootlocal.sh?
Code:
#!/bin/sh
# put other system startup commands here

GREEN="$(echo -e '\033[1;32m')"

echo
echo "${GREEN}Running bootlocal.sh..."
#pCPstart------
/usr/local/etc/init.d/pcp_startup.sh 2>&1 | tee -a /var/log/pcp_boot.log
#pCPstop------
[COLOR=DarkRed]
/home/tc/StartServer.sh &[/COLOR]
 sudo /usr/local/bin/squeezelite-cdsp.sh start &
(By the way, the trailng "&" should not be needed for "squeezelite-cdsp.sh", and can be removed)


/ πr
 
3.14 @ pi r :D

You proberly have a point there, but i have been using it myself for quite some months on two RPI's here at home.

But it could be, that something else on Fra's machine is stopping the bootprocess before mine is executed?

I will try to remove the "&" from the squeezelite-cdsp.sh start in bootlocal.sh here and see how it goe's...

If someone here know's a better way of starting the "main.py" webinterface "onboot" than scripting it the way i do, please chime in here...

Goodnight ZZzzz...

Jesper.
 
Changing the line with "squeezelite-cdsp.sh start" in bootlocal.sh, won't make any difference. bootlocal.sh never gets there. It freezes on the startserver.sh script, that never finish.

Do you both run the same version of main.py?
What is main.py waiting for, and why?

/ πr