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

Up to and including aiohttp it looks good. Then you probably downloaded the source code of the backend, which is only half of what you need. You need camillagui.zip from here: Release v0.4.2 * HEnquist/camillagui-backend * GitHub


All web apps are split into a backend and a frontend. The frontend is html and javascript, and runs in the browser. This is the part you see. It can't talk to databases, or hardware etc directly. Instead all low level stuff is handled by a backend that runs on the server side. This backend presents an interface the frontend can talk to via http requests. The backend then translates between a http request to some more low level function, like opening a file or asking some other process for some piece of information.


The frontend code must be provided to the browser. In a large system with many users this part is handled by a dedicated web server (which becomes the third part) for performance reasons. Here, with one or possibly a few clients, this isn't necessary and the backend can easily handle serving that as well. This is why the full backend package also must include the frontend code.


Another thing, the frontend code that is included in the backend zip is a "compiled" version. I write "compiled" because it's actually compiled from javascript to javascript. What it does it optimize the code and include only the parts of all libraries that are actually used.


Does this help?

Also Jesper will probably need to set the port to 3011 in camillagui.yml in the config subfolder of camillagui. And lastly start the server with :

python3 /home/tc/camillagui/main.py

You can add this command to your startup file later.
 
[Henrik]
Up to and including aiohttp it looks good. Then you probably downloaded the source code of the backend, which is only half of what you need. You need camillagui.zip from here: Release v0.4.2 * HEnquist/camillagui-backend * GitHub
I think i got this package right. I have placed it (just for test for now) /home/tc/DSP_Engine/Camilla_GUI_v0.4.2
This dir contains this:
tc@piCorePlayer:~/DSP_Engine/Camilla_GUI_v0.4.2$ ls -all
total 60
drwxrwxr-x 5 tc staff 220 Oct 3 16:26 ./
drwxr-sr-x 5 tc staff 140 Oct 3 14:14 ../
-rw-r--r-- 1 tc staff 35149 Oct 3 13:50 LICENSE.txt
-rw-r--r-- 1 tc staff 3336 Oct 3 13:50 README.md
drwxr-xr-x 2 root root 100 Oct 3 16:26 __pycache__/
drwxr-xr-x 3 tc staff 260 Oct 3 14:12 build/
drwxr-xr-x 2 tc staff 60 Oct 3 14:12 config/
-rw-r--r-- 1 tc staff 845 Oct 3 13:50 main.py
-rw-r--r-- 1 tc staff 1544 Oct 3 13:50 routes.py
-rw-r--r-- 1 tc staff 463 Oct 3 13:50 settings.py
-rw-r--r-- 1 tc staff 6385 Oct 3 13:50 views.py
And the config is like this:
I am sure this is wrong, as i have pointed the config & coeff dir to where i have my filters
Also i'am not sure what coeff filters are ?
tc@piCorePlayer:~/DSP_Engine/Camilla_GUI_v0.4.2$ cat config/*yml
---
camilla_host: "192.168.1.95"
camilla_port: 3011
port: 5000
config_dir: "~/DSP_Engine/filters"
coeff_dir: "~/DSP_Engine/filters"



tc@piCorePlayer:~/DSP_Engine/Camilla_GUI_v0.4.2$ python3 ./main.py
{'camilla_host': '192.168.1.95', 'camilla_port': 3011, 'port': 5000, 'config_dir': '/home/tc/DSP_Engine/filters', 'coeff_dir': '/home/tc/DSP_Engine/filters'}
No plotting!
======== Running on http://0.0.0.0:5000 ========
(Press CTRL+C to quit)

[wineds]
Also Jesper will probably need to set the port to 3011 in camillagui.yml in the config subfolder of camillagui. And lastly start the server with :

python3 /home/tc/camillagui/main.py

Thanks :) ... In my case (for now) i start the server with:
python3 /home/tc/DSP_Engine/Camilla_GUI_v04.2/main.py

I can actually make it start, but webinterface tells me i am offline.
And after that the output of then main.py start spitting a lot of errors:
tc@piCorePlayer:~/DSP_Engine/Camilla_GUI_v0.4.2$ python3 /home/tc/DSP_Engine/Camilla_GUI_v0.4.2/main.py
{'camilla_host': '192.168.1.95', 'camilla_port': 3011, 'port': 5000, 'config_dir': '/home/tc/DSP_Engine/filters', 'coeff_dir': '/home/tc/DSP_Engine/filters'}
No plotting!
======== Running on http://0.0.0.0:5000 ========
(Press CTRL+C to quit)
state
offline
signalrangedb
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/home/tc/DSP_Engine/Camilla_GUI_v0.4.2/views.py", line 36, in get_param
result = cdsp.get_signal_range_dB()
File "/usr/local/lib/python3.6/site-packages/camilladsp/camilladsp.py", line 147, in get_signal_range_dB
sigrange = self.get_signal_range()
File "/usr/local/lib/python3.6/site-packages/camilladsp/camilladsp.py", line 140, in get_signal_range
sigrange = self._query("getsignalrange")
File "/usr/local/lib/python3.6/site-packages/camilladsp/camilladsp.py", line 61, in _query
raise IOError("Not connected to CamillaDSP")
OSError: Not connected to CamillaDSP
capturerate
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/home/tc/DSP_Engine/Camilla_GUI_v0.4.2/views.py", line 40, in get_param

Etc...
Etc..
..

I'am sure my config is the problem here.

Jesper.
 

Attachments

  • Screenshot from 2020-10-04 06-14-18.png
    Screenshot from 2020-10-04 06-14-18.png
    107.3 KB · Views: 228
I prefer to use some hardware volume control (with remote) either inside the dac or after the dac. With a 24-bit dac software volume control is basically the same quality, but I don't fully trust a software volume control to never, not even once, forget the volume setting and go to full volume.



I don't know enough about squeezelite to give a very good answer. Does it always output the same format it's playing, eg 16-bit it output as 16-bit? Or can it give 32 bits no matter what the file is? If it's outputting 16 bits, then it would be a pity if the sw volume control is done in squeezelite. But if it actually gives 32 bits out, then a 20dB attenuation of a 16-bit signal isn't degrading the signal. It's of course not bit perfect, but it still contains all the 16 bits of information. This signal can then be fed through DSP without any problems. The result would be the same as going into the DSP at full volume and then doing sw volume control after.


Placing the filtering server-side is quite elegant. From my limited reading about this, it seems not that difficult and it has been working with brutefir but probably doesn't any more since the plugin isn't maintained (I could easily be wrong here). The existing plugin should be a good starting point for a camilladsp integration, even if it's currently broken.


The potential problem is what happens if you have multiple clients, let's say a primary and secondary sound system in different rooms. Can each client request a separate filter? If not it becomes locked to a single client and you need a separate server for each client.


Nobody (I know) uses HW volume (pot or IR) controls anymore. ;)

squeezelite or mpd would let you use a DAC based VC, but only if you have that DAC defined as output device and the DAC offers it via driver. In case of attached DSP (Camilla or brutefir) squeezelite or mpd would just see stdout or alsaloop. I don't know if you can define mixer-in mixer-out features in the asound.conf of the alsaloop device that would transparently transfer the VC codes from app to the HW.

lykkedk could of course further hack squeezelite to bypass the alsaloop output towards the DSP and talk to the DAC (amixer) directly regarding HW VC control.


squeezelite like mpd can output pretty much any samplerate or precision. 32bit is no issue. But I don't see your 20dB. Camilla alone does at least 6dB. Therefore in real life I'd expect rather a 30dB+ attenuated signal entering the DSP. I havn't seen many people running a gain optimized chain.


All this is no issue or discussion if you run the DSP before the player app or volume control stage.

LMS can handle it with a simple one-liner in the custom-convert.conf.
If you'd need a more complex filter switching feature you simply write a basic
wrapper-script and refer to it in the custom-convert.conf . It'd work with pipes file>>DSP>>stdout or file>>app>>stdoutin>>DSP>>stdout . app can be any app like sox, flac or alike. There's no need for LMS plugins. Most of them are not well maintained anyhow.

On top LMS allows to route a pipe to whatever client identified by MAC.

The only reason for not using LMS as the DSP host is if you go multichannel.
For those doing room correction and a bit of EQing LMS would probably be the better choice.

There's more beside the LMS universe.

Most other quality (pro) apps work with ""plugins"". For a reason. They all do the DSP part prior to VC. VC is usually the last part of the chain.
 
I don't know if you can define mixer-in mixer-out features in the asound.conf of the alsaloop device that would transparently transfer the VC codes from app to the HW.

Alsa controls and alsa stream are configured separately in asound configs - pcm vs. ctl sections. That gives an option for players which do not have a separate config for volume control (e.g. mixer_device in mpd) to use a single pcm device for pcm and ctl methods and yet route the ctl commands to a different alsa device. I.e. the stream can go to aloop, while volume control commands are passed to the actual soundcard, circumventing the DSP chain.
 
Alsa controls and alsa stream are configured separately in asound configs - pcm vs. ctl sections. That gives an option for players which do not have a separate config for volume control (e.g. mixer_device in mpd) to use a single pcm device for pcm and ctl methods and yet route the ctl commands to a different alsa device. I.e. the stream can go to aloop, while volume control commands are passed to the actual soundcard, circumventing the DSP chain.

That's nice to know. So. For audiointerfaces that offer ondevice VC via driver that'd be the way to go.
 
I can actually make it start, but webinterface tells me i am offline.
And after that the output of then main.py start spitting a lot of errors:


I'am sure my config is the problem here.

Jesper.
Ah now I see! The problem is just that you are running the old version of pycamilladsp, from before I changed to the json protocol. Get this one instead: https://github.com/HEnquist/pycamilladsp/archive/develop.zip


Since everything 0.4.x is in beta at the moment things are a bit messy, sorry about that. Once I make production 0.4 release I will merge everything to master.
 
Nobody (I know) uses HW volume (pot or IR) controls anymore. ;)

squeezelite or mpd would let you use a DAC based VC, but only if you have that DAC defined as output device and the DAC offers it via driver. In case of attached DSP (Camilla or brutefir) squeezelite or mpd would just see stdout or alsaloop. I don't know if you can define mixer-in mixer-out features in the asound.conf of the alsaloop device that would transparently transfer the VC codes from app to the HW.

lykkedk could of course further hack squeezelite to bypass the alsaloop output towards the DSP and talk to the DAC (amixer) directly regarding HW VC control.


squeezelite like mpd can output pretty much any samplerate or precision. 32bit is no issue. But I don't see your 20dB. Camilla alone does at least 6dB. Therefore in real life I'd expect rather a 30dB+ attenuated signal entering the DSP. I havn't seen many people running a gain optimized chain.


All this is no issue or discussion if you run the DSP before the player app or volume control stage.

LMS can handle it with a simple one-liner in the custom-convert.conf.
If you'd need a more complex filter switching feature you simply write a basic
wrapper-script and refer to it in the custom-convert.conf . It'd work with pipes file>>DSP>>stdout or file>>app>>stdoutin>>DSP>>stdout . app can be any app like sox, flac or alike. There's no need for LMS plugins. Most of them are not well maintained anyhow.

On top LMS allows to route a pipe to whatever client identified by MAC.

The only reason for not using LMS as the DSP host is if you go multichannel.
For those doing room correction and a bit of EQing LMS would probably be the better choice.

There's more beside the LMS universe.

Most other quality (pro) apps work with ""plugins"". For a reason. They all do the DSP part prior to VC. VC is usually the last part of the chain.
I would actually say the exact opposite. Nobody I know uses software volume control!



The 20dB is just a number I took since you wrote it somewhere. Let's say we convert 16 bits to 32 bit int. That means we are using the 16 upper bits out of the 32. The 16 lower bits are all empty, meaning the lsb of the actual signal sits 96dB above the lsb of the data. In this case it would be fine to attenuate by up to 96dB without losing any information. If we go with the common 32-bit float instead, we have a 24 bit significand, which give a margin of 48 dB.



Once the signal reaches Camilladsp it gets converted to 64-bit float, which has a significand of 53 bits. The numerical noise from FFT etc ends up in the -300dB range even if many long filters are used. So even if you send in a heavily attenuated signal, the numerical noise from the DSP won't affect it.


It changes a bit if we compile for 32-bit floats. Then the numerical noise ends up in the -140dB range. A heavily attenuated signal would get some added noise from filtering. That noise will still be lower than the noise floor of DACs, but it's getting close. There is however very little reason for running with 32-bit floats since 64 bit is nearly as fast nowadays.


So the short version is that f you run 64-bit floats, in practice it doesn't matter if you have the sw volume control before or after the dsp. With 32-bit float, it makes a small difference that most likely drowns in the dac noise.
 
I would actually say the exact opposite. Nobody I know uses software volume control!

You know me now. ;)

And probably some others.

Where have you been the last decade. Pretty much the entire computer based audio world, incl. the streaming world and smartphone world asf. uses SW volume control.

Not sure what you're talking about.
 
You know me now. ;)

And probably some others.

Where have you been the last decade. Pretty much the entire computer based audio world, incl. the streaming world and smartphone world asf. uses SW volume control.

Not sure what you're talking about.
Ok if you include phones, laptops etc then of course I and everyone I know use sw volume control. I meant just in the main hifi system.
 
Ah now I see! The problem is just that you are running the old version of pycamilladsp, from before I changed to the json protocol. Get this one instead: https://github.com/HEnquist/pycamilladsp/archive/develop.zip


Since everything 0.4.x is in beta at the moment things are a bit messy, sorry about that. Once I make production 0.4 release I will merge everything to master.

;)

Got it running now...

My workflow in very early state get it going like this :
tce-load -wo compiletc.tcz // download once
tce-load -i compiletc.tcz // load

tce-load -wo python3.6-dev // download once
tce-load -i python3.6-dev // load

sudo filetool.sh -b // save until here

sudo pip3 install setuptools

Transfer pycamilladsp-develop to /home/tc/DSP_Engine/
Transfer Camilla_GUI_v0.4.2 to /home/tc/DSP_Engine/

cd /home/tc/DSP_Engine/pycamilladsp-develop
sudo -H pip3 install .

sudo -H pip3 install aiohttp

cd /home/tc/DSP_Engine/Camilla_GUI_v0.4.2
nano /home/tc/DSP_Engine/Camilla_GUI_v0.4.2/config/*yml
- change to right dir + port 3011 ::
---
camilla_host: "0.0.0.0"
camilla_port: 3011
port: 5000
config_dir: "~/DSP_Engine/filters"
coeff_dir: "~/DSP_Engine/filters"

python3 /home/tc/DSP_Engine/Camilla_GUI_v0.4.2/main.py

Rgds; Jesper.
 

Attachments

  • Running_1.png
    Running_1.png
    109.2 KB · Views: 229
I spent a bit of time tweaking my room EQ filters on the weekend. Recreating a new set of filters for 5 different sample rates (ie : 10 filters) in rephase is quite laborious and error prone. This is in no way a criticism of rephase! Would it be useful if CamillaDSP could directly import REW filter settings which are in XML format? Rephase can import this format. Additionally CamillaDSP could then create filters on the fly for whatever sample rate was incoming?
 

Attachments

  • REW XML.zip
    982 bytes · Views: 55
Last edited: