CamillaDSP for piCorePlayer

Installation was super easy, thanks for the great work.
I currently have two one issues:
1) CamillaDSP seemingly does not reach to playback: muting, dimming have no effect. In pCP the output setting is camilladsp, in cDSP I entered plughw:CARD=sndrpihifiberry and state says RUNNING. The levels of the meters move. But muting and dimming still do not work.
 
You have to create a volume or loudness filter and put it in the pipeline for some/all channels in order to have any effect.
I assume, you solved the playback issue?

I will keep trying then
This should solve itself after some time - not sure, what I could do about this in the meantime :/
I already altered the script to use the pcp-load method as per Greg's suggestion.

Just for clarification:
Did loading openssl.tcz via the UI fail?
Or did it work, but the script still failed afterwards?
 
Just for clarification:
Did loading openssl.tcz via the UI fail?
Or did it work, but the script still failed afterwards?
UI says its already installed. Still cant get it to work :/

I made another clean image and resized to exactly 200MB this time. Usually tried more.

Do I need to do something with the md5 text included in the zip?
I unzipped and the imager only writes the img i think (using Raspberry Pi Imager v1.7.5).
Also tried with Win32 Disk Imager - 1.0.
I tried redownloading the files but still no luck. Should i go for the 32 bit version?


This is what i get (Sorry for posting something so long):

tc@pCP:~$ wget https://github.com/JWahle/piCoreCDSP/raw/main/install_cdsp.sh && chmod u+x install_cdsp.sh && ./install_c
dsp.sh
Connecting to github.com (140.82.121.4:443)
Connecting to raw.githubusercontent.com (185.199.111.133:443)
saving to 'install_cdsp.sh'
install_cdsp.sh 100% |************************************************************************| 6225 0:00:00 ETA
'install_cdsp.sh' saved

### Create CamillaDSP config folders

cd /mnt/mmcblk0p2/tce
mkdir -p camilladsp/configs
mkdir -p camilladsp/coeffs

### Create default config

cd /mnt/mmcblk0p2/tce/camilladsp
echo '
devices:
samplerate: 44100
chunksize: 2048
queuelimit: 4
capture:
type: Stdin
channels: 2
format: S16LE
playback:
type: Alsa
channels: 2
device: "plughw:Headphones"
format: S16LE
' > Headphones.yml
/bin/cp Headphones.yml configs/Headphones.yml
if [ ! -f "active_config" ]; then
ln -s configs/Headphones.yml active_config
fi

### Install ALSA CDSP

cd /tmp
pcp-load -wil -t /tmp git compiletc libasound-dev # Downloads to /tmp/optional and loads extensions temporarily
Checking Dependancies for git.tcz...
Downloading git.tcz.dep....OK
Downloading curl.tcz.dep....OK
Downloading openssl.tcz.dep....OK
Downloading ca-certificates.tcz.dep....OK
Downloading expat2.tcz.dep....OK
Downloading libgcrypt.tcz.dep....OK
Downloading libgpg-error.tcz.dep....OK
Dependancy check complete for git.tcz.
Downloading: libgpg-error.tcz
Checking Dependancies for compiletc.tcz...
Downloading compiletc.tcz.dep....Connecting to repo.picoreplayer.org (172.67.157.97:443)
OK
saving to 'libgpg-error.tcz'
Downloading bison.tcz.dep....OK
libgpg-error.tcz 100% |************************************************************************| 94208 0:00:00 ETA
'libgpg-error.tcz' saved
Checking MD5 of: libgpg-error.tcz.....OK
Downloading: libgcrypt.tcz
Downloading diffutils.tcz.dep....OK
Connecting to repo.picoreplayer.org (172.67.157.97:443)
Downloading file.tcz.dep....OK
saving to 'libgcrypt.tcz'
libgcrypt.tcz 100% |************************************************************************| 400k 0:00:00 ETA
'libgcrypt.tcz' saved
Checking MD5 of: libgcrypt.tcz.....OK
Downloading findutils.tcz.dep....OK
Downloading: ca-certificates.tcz
Downloading flex.tcz.dep....OK
Connecting to repo.picoreplayer.org (172.67.157.97:443)
Downloading gawk.tcz.dep....OK
saving to 'ca-certificates.tcz'
ca-certificates.tcz 100% |************************************************************************| 144k 0:00:00 ETA
'ca-certificates.tcz' saved
Checking MD5 of: ca-certificates.tcz.....OK
Downloading: openssl.tcz
Downloading mpfr.tcz.dep....OK
Connecting to repo.picoreplayer.org (172.67.157.97:443)
Downloading gmp.tcz.dep....OK
saving to 'openssl.tcz'
Downloading isl.tcz.dep....OK
openssl.tcz 100% |************************************************************************| 1676k 0:00:00 ETA
'openssl.tcz' saved
Checking MD5 of: openssl.tcz.....FAIL
MD5 of tcz: 034a8f55e5325eafe5f11a879a99b8b5 openssl.tcz
MD5 check: h :nIDAit)d&$47[@{ۿ Downloading mpc.tcz.dep....OK
Downloading gcc.tcz.dep....OK
Downloading gcc_base-dev.tcz.dep....OK
Downloading gcc_libs-dev.tcz.dep....OK
Downloading gcc_libs.tcz.dep....OK
Downloading binutils.tcz.dep....OK
Downloading glibc_add_lib.tcz.dep....OK
Downloading glibc_apps.tcz.dep....OK
Downloading glibc_gconv.tcz.dep....OK
Downloading grep.tcz.dep....OK
Downloading pcre.tcz.dep....OK
Downloading bzip2-lib.tcz.dep....OK
Downloading m4.tcz.dep....OK
Downloading make.tcz.dep....OK
Downloading patch.tcz.dep....OK
Downloading pkg-config.tcz.dep....OK
Downloading glib2.tcz.dep....OK
Downloading gamin.tcz.dep....OK
Downloading libelf.tcz.dep....OK
Downloading sed.tcz.dep....OK
Downloading e2fsprogs_base-dev.tcz.dep....OK
Downloading libffi_base-dev.tcz.dep....OK
Downloading glibc_base-dev.tcz.dep....OK
Downloading util-linux_base-dev.tcz.dep....OK
Downloading zlib_base-dev.tcz.dep....OK
Downloading linux-5.15.y_api_headers.tcz.dep....OK
Dependancy check complete for compiletc.tcz.
There was a error downloading libasound-dev.tcz.

I cut the retries as this wouldve been even more text.
 
If piCorePlayer is running properly, you don't have to reinstall when the script aborts.
Just restarting is sufficient to restore the initial state, since the changes are only saved, if the script finishes without error.

You can try to switch the extension repo:
Go to Main Page > Extensions > then wait for the check to complete (until you see 5 green check marks)
Then go to > Available > Current repository > select "piCorePlayer mirror repository" and "Set".
Now you can run the script again.

Let me know, if this worked.
 
  • Like
Reactions: 1 user
Another question, Johannes:

I am trying to integrate a script that connects a home automation knob with camillaDSP. This is the thread where I took it from: https://www.audiosciencereview.com/...pi-help-needed-with-python.40320/post-1524295 The knob is a zigbee device and it connects to camillaDSP via:

Zigbee rotary knob ---zigbee signal---> zigbee2mqtt zigbee to mqtt bridge ---mqtt---> Mosquitto mqtt broker ---mqtt---> Eclipse Paho mqtt Python Client ---python---> Pycamilladsp python library <------> Camilladsp

Everything is installed and working, the python script is the final piece in the chain. This is the blank script (takes your IP and knob ID):

#!python3
import json
import paho.mqtt.client as mqtt
import time
from camilladsp import CamillaConnection
HOST, PORT = "127.0.0.1", 1234

def on_connect(client, userdata, flags, rc, properties=None): #added properties=None to make sure it works with mqtt v3x and v5
# print("Connected with result code "+str(rc))

broker="192.168.xxx.xx"
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("zigbee2mqtt/0xdc8e95fffe8a7094",0)
global active
active = 1
global tone_db_change
tone_db_change = 0

def on_message(client, userdata, msg):
# print(msg.topic+" "+str(msg.payload))
payload = json.loads(msg.payload)
action_sense = payload['action']
global tone_db_change
global active
tone_db_change = 0
# print("active", active)
if action_sense == 'single':
if active == 1:
active = 2
elif active == 2:
active = 1
elif action_sense == 'rotate_right':
tone_db_change = 0.5
elif action_sense == 'rotate_left':
tone_db_change = -0.5
else :
tone_db_change = 0
cdsp = CamillaConnection(HOST, PORT)
cdsp.connect()
cdspconf = cdsp.get_config()
filters = cdspconf['filters']
bass = filters['Bass']
bass_parameters = bass['parameters']
# print(bass_parameters)
bass_gain = bass_parameters['gain']
# print(bass_gain)
treble = filters['Treble']
treble_parameters = treble['parameters']
# print(treble_parameters)
treble_gain = treble_parameters['gain']
# print(treble_gain)
if active == 1:
new_bass_gain = bass_gain + tone_db_change
if new_bass_gain > 9.5:
new_bass_gain = 9.5
elif new_bass_gain < -9.5:
new_bass_gain = -9.5
# print(new_bass_gain)
bass_parameters['gain'] = new_bass_gain
elif active == 2:
new_treble_gain = treble_gain + tone_db_change
if new_treble_gain > 9.5:
new_treble_gain = 9.5
elif new_treble_gain < -9.5:
new_treble_gain = -9.5
# print(new_treble_gain)
treble_parameters['gain'] = new_treble_gain
cdsp.set_config(cdspconf)


client = mqtt.Client(client_id="", clean_session=True, userdata=None, transport="tcp")
client.on_connect = on_connect
client.on_message = on_message

client.connect("192.168.xxx.xx")

client.loop_forever()

I receive the following error message when I start it:

tc@pCP:~$ python3 /home/tc/tonecontrol.py
Traceback (most recent call last):
File "/home/tc/tonecontrol.py", line 5, in <module>
from camilladsp import CamillaConnection
ModuleNotFoundError: No module named 'camilladsp'

What am I missing? The script was created for a different, the Raspi OS, but until here I got everything working on TinyCore. How can I make the script find camilladsp and connect?

Thanks in advance!
 
The 'camilladsp' module comes from the pycamilladsp python library.

There are several ways to set up python projects with dependencies, but the cleanest way I found is like I did to install CamillaGUI:
  • install PIP (python package manager)
  • create and activate a virtual python environment in some folder
  • install the dependencies (pycamilladsp and websocket_client)
  • put your python script inside the folder

Then you can run it like I did here.

You can either do this in /home/tc/yourproject and use the normal backup functionality
or create it in /usr/local/yourproject and create a module like I did here.
The piCorePlayer documentation contains more info on the backup mechanism and the extension mechanism.
 
Do you have an idea why the import function used in tonecontrol.py does not find camilladsp that your script installed?
from camilladsp import CamillaConnection
ModuleNotFoundError: No module named 'camilladsp'
I tried to start the tonecontrol.py in the virtual environment, and could not solve the issue.

Added: Maybe I activated the wrong way, I am not very knowledgeable and always work from descriptions.
 
Last edited:
Do you have an idea why the import function used in tonecontrol.py does not find camilladsp that your script installed?
Yes, because it is only installed locally for the python environment.
You can try to reuse the piCoreCDSP/CamillaGUI python environment for your script like this:
Code:
source /usr/local/camillagui/environment/bin/activate
python3 <absolute path to your python file>
 
Last edited:
Did a fresh pCP install and ran the script. All appears to work fine except when pausing the player I see a lot of warning messages in the log window repeating every second. The CamillaDSP GUI State is alternating between STALLED and PAUSED a couple of times per second while the Capture Sample Rate shows 88200.

I tried several Device settings but could not resolve this issue. Anyone has any clue?

Code:
2023-10-15 07:47:18.552910 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85819.7930616801 Hz
2023-10-15 07:47:19.559236 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85857.06379681268 Hz
2023-10-15 07:47:20.565813 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85841.47245944264 Hz
2023-10-15 07:47:21.571144 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85938.50866159408 Hz
2023-10-15 07:47:22.575820 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85995.66746262889 Hz
2023-10-15 07:47:23.580165 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86030.65928174842 Hz
2023-10-15 07:47:24.585572 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85931.2671936568 Hz
2023-10-15 07:47:25.590182 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86003.37479631683 Hz
2023-10-15 07:47:26.594888 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85995.74680762364 Hz
2023-10-15 07:47:27.599129 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86034.61743236108 Hz
2023-10-15 07:47:28.604029 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85985.29926455919 Hz
2023-10-15 07:47:29.610077 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85880.61004424587 Hz
2023-10-15 07:47:30.614898 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85979.67246491584 Hz
2023-10-15 07:47:31.620193 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85944.72697452657 Hz
2023-10-15 07:47:32.624248 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86051.53602589387 Hz
2023-10-15 07:47:33.628475 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86036.13408891621 Hz
2023-10-15 07:47:34.633441 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85973.62977422985 Hz
2023-10-15 07:47:35.638267 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 85985.22798265163 Hz
2023-10-15 07:47:36.642252 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86056.91183224061 Hz
2023-10-15 07:47:37.646592 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86026.97276561083 Hz
2023-10-15 07:47:38.650442 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86068.67862164597 Hz
2023-10-15 07:47:39.654917 WARN  [src/filedevice.rs:446] sample rate change detected, last rate was 86014.64963881239 Hz

CamillaDSP.PNG
 
Solved it by using the squeezelite -C option with a positive value i.e. 5. This will close the output after 5 seconds and the CamillaDSP State will go to Offline.

Code:
2023-10-15 08:30:05.180640 INFO  [src/bin.rs:711] CamillaDSP version 1.0.3
2023-10-15 08:30:05.180812 INFO  [src/bin.rs:712] Running on linux, arm
2023-10-15 08:30:05.231835 INFO  [src/alsadevice.rs:161] Starting playback from Prepared state
2023-10-15 08:30:19.036832 INFO  [src/bin.rs:420] Capture finished
2023-10-15 08:30:19.036945 INFO  [src/bin.rs:410] Playback finished
 
  • Like
Reactions: 1 user
Hi, I tried to run the script, but it always fails, because it doesn't habe permission to edit /etc/asound.conf (or create files there.)
My installation is a freshly installed PCP. Isn't it normal, that users can't write in /etc?

/etc/asound.conf should be writable to the user tc.
How did you connect to the piCorePlayer?
Can you post the exact log message (last ~30 lines of the log)?
 
OK, now I chowned /etc/asound.conf to tc:staff and the script completed successfully. Are those the normal rights for the file? Because everything else in the directory is root:root. Could be that I recreated that file before and it used the permissions of the directory.