CamillaDSP - Cross-platform IIR and FIR engine for crossovers, room correction etc.

So it seems that squeezelite is locking the samplerate somehow (my guess!)

See my post above, it explains why your setup does not work.

The loopback module creates two connected alsa devices, sharing a common memory buffer. That means no resampling, no sample format change, only one writing pointer and one reading pointer (it is a bit more complicated because each device can setup different buffer/period size).

The first side to open defines the params for both sides. The other side must use the same params if it wants to open its-side device. Change can happen only when both devices are released/closed.

Use the /proc/asound files, they provide key information for alsa troubleshooting.
 
Actually there is the module parameter pcm_notify and PCM control pcm_notify (available in amixer).

IIUC the module param should allow closing the capture side (with error) when params change on playback side. That would be easy to use in camilladsp - just re-opening the device with correct params.
 
It looks as if squeezelite can send audio data to stdout, could you try piping that to CamillaDSP? Then you wouldn't need any Loopback. It's probably goood to set "queuelimit" to 1 for that.

set "queuelimit" to 1
Where to set this? in camilladsp ?

I have to figure out howto grab the stout from squeezelite into camilladsp also.
I guess i will have to change th .yml file for that to happend.

Will be back :)

Jesper.
 
phofman

The first side to open defines the params for both sides. The other side must use the same params if it wants to open its-side device. Change can happen only when both devices are released/closed.

Use the /proc/asound files, they provide key information for alsa troubleshooting.

I understand this now.

What i do is to close/reload the camilladsp through python, samplerate is set there at output.
That part is working.
The part where i need to stop/reload/close<>open the squeezelite is not working.
As you wrote i need to stop booth devices.

Will go thinking about this :)

Jesper.
 
Henrik :)

Someone at slimserver forum (LMS) asked me this :
f you want/need to do some development rather than have scripts or modded squeezelite, wouldn't it be better for camilla DSP to accept a WAV input (sample rate,width in header in line with data) rather than plain PCM so that from each data stream it can determine on the fly the audio format. It would then just be a drop into LMS conf file.

With more explanation :
The WAV header is a fixed number (44?) of bytes at start of file or stream. All camilladsp would have to do is on startup read the WAV header, analyse it ( Page not found | Jawad's Blog ) and then use the values as if they are default or from command line / config file.
Audio DSP processing then starts at byte 45. Chunk length should be zero to indicate infinity - it is not required in a streaming environment.

You might even ask the developer to do it as a command line option (e.g. -w) ?

This
It would then just be a drop into LMS conf file
is just to configure for them using LMS howto transcode (flac etc...)

I hope it's okay to ask you if this could be possible to do what he suggest?

Regarding the other suggestions phofman and you told here (stdout & snd-aloop pcm_notify, sry.. i really havent figured it out yet, and i think the suggestion from the other forum was important)

Jesper.
 
Henrik :)

Someone at slimserver forum (LMS) asked me this :


With more explanation :


This is just to configure for them using LMS howto transcode (flac etc...)

I hope it's okay to ask you if this could be possible to do what he suggest?

Regarding the other suggestions phofman and you told here (stdout & snd-aloop pcm_notify, sry.. i really havent figured it out yet, and i think the suggestion from the other forum was important)

Jesper.
Hmm this would require big changes to how CamillaDSP handles the configuration internally. It would also need either a set of config files (one for each sample frequency) or a way to autogenerate them.



But I think the same end result can be achieved by using some supervising process, and let that process launch CamillaDSP with the right settings and then feed it data. Since the config is standard YAML it's very easy to autogenerate a valid config file. Python should be more than fast enough for this.
 
Hmm this would require big changes to how CamillaDSP handles the configuration internally. It would also need either a set of config files (one for each sample frequency) or a way to autogenerate them.



But I think the same end result can be achieved by using some supervising process, and let that process launch CamillaDSP with the right settings and then feed it data. Since the config is standard YAML it's very easy to autogenerate a valid config file. Python should be more than fast enough for this.

Cool enough Henrik... You descide :)

Regarding the use of the snd-aloop option pcm_notify. How do i use that?
I can't seem to find much about it.

ilename: /lib/modules/4.19.97-v7l+/kernel/sound/drivers/snd-aloop.ko
license: GPL
description: A loopback soundcard
author: Jaroslav Kysela <perex@perex.cz>
srcversion: 3B8A8D841D62048BC909BB7
depends: snd-pcm,snd
intree: Y
name: snd_aloop
vermagic: 4.19.97-v7l+ SMP mod_unload modversions ARMv7 p2v8
parm: index:Index value for loopback soundcard. (array of int)
parm: id:ID string for loopback soundcard. (array of charp)
parm: enable:Enable this loopback soundcard. (array of bool)
parm: pcm_substreams:pCM substreams # (1-8) for loopback driver. (array of int)
parm: pcm_notify:Break capture when PCM format/rate/channels changes. (array of int)

Jesper.
 
I tried to use the pcm notify param as well the PCM control, to no avail. I sent a question to the mailing list, I believe it will be resolved soon Functionality of pcm_notify in snd-aloop?

Like :)

I created a file /etc/modprobe.d/ - sndloop.conf
In that file i pasted :
options snd-aloop pcm_notify=1

And after a reboot i got this :
pi@SuperBPI:/etc/modprobe.d $ modprobe -c | grep snd_aloop
options snd_aloop pcm_notify=1

But lack of dokumentation i can't tell if pcm_notify=1 is the right to do.

Jesper.
 
Hello here.

So i'am playing some with the engine.
So trying the stdio thing as suggested by Henrik some posts ago i modified my rate_44100.yml file into this :
---
devices:
samplerate: 44100
buffersize: 8192
target_level: 4096
adjust_period: 5

capture:
type: File
channels: 2
device: "/dev/stdin"
format: S32LE

playback:
type: Alsa
channels: 2
device: "sound_out"
format: S32LE

filters:

...
..

So while trying i started the squeezelite player with output to stdout into a file "rawfile.dat"

Trying to playback like this:
cat rawfile.dat | camilladsp rate_44100.yml
Does not work; i'am pretty sure my .yml file is wrong?

Jesper.
 
For the File device you give "filename", not "device"!

I broke the error output from config file errors in develop. Get the latest one in "newfilters" instead!

So like this :
---
devices:
samplerate: 44100
buffersize: 8192
target_level: 4096
adjust_period: 5

capture:
type: File
channels: 2
device: "/home/pi/rawfile.dat"
format: S32LE

playback:
type: Alsa
channels: 2
device: "sound_out"
format: S32LE

I must be dumb :eek:...
Running squeezelite with output STDOUT, and camilladsp like this :
squeezelite -n stdioPlayer -o - -a 32 > /home/pi/rawfile.dat

cat /home/pi/rawfile.dat | camilladsp -v /home/pi/Cfilters/rate_44100.yml

I cant make it work, camilla just exit's

Jesper.
 
If you pipe with cat, change to this in the capture device

:)

Working like this :

squeezelite -n XioPlayX -o - -a 32 -z (n=name, -o - =stdout, -a32=buf -z=daemonize)
camilladsp -v /home/pi/Cfilters/rate_44100.yml

---
devices:
samplerate: 44100
buffersize: 8192
target_level: 4096
adjust_period: 5

capture:
type: File
channels: 2
filename: "/dev/stdin"
format: S32LE
playback:
type: Alsa
channels: 2
device: "sound_out"
format: S32LE

But no sound, and squeezelite is consuming like 100% CPU...
also squeezelite acting very unstable like this... not camilladsp's fault ;)
I created an issue on the squeezelite git for this a couble of hours ago allready.

Let's see if there will be any correction on that?

Jesper.