diyAudio

diyAudio (https://www.diyaudio.com/forums/index.php)
-   PC Based (https://www.diyaudio.com/forums/pc-based/)
-   -   CamillaDSP - Cross-platform IIR and FIR engine for crossovers, room correction etc. (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc.html)

HenrikEnquist 17th February 2020 06:39 PM

CamillaDSP - Cross-platform IIR and FIR engine for crossovers, room correction etc.
 
I would like to announce CamillaDSP, a general purpose tool for routing and filtering sound. It can be used for example for building crossovers for active speakers, or for performing room correction.

You can find the source code here: GitHub - HEnquist/camilladsp


There is a second repository for configuration help here: GitHub - HEnquist/camilladsp-config: Help for setting up CamillaDSP, example config files etc

Quick summary
  • For Linux, macOS and Windows
  • Written in Rust
  • IIR filters (BiQuad)
  • FIR filters (Convolution via FFT)
  • Built-in sample rate converter
  • Filters can be chained freely
  • Flexible routing
  • Alsa, PulseAudio, Wasapi, CoreAudio, File and stdio input/output
  • Simple YAML configuration
  • All calculations done with 64-bit floats

I have been using BruteFIR for crossovers for quite some time, but there were two main things I wanted to improve upon. Firstly BruteFIR only supports FIR filters, and I wanted the ability to also use BiQuad without having to make an overly complicated setup. Secondly when BruteFIR encounters a buffer underrun it always exits with a "broken pipe" error instead of just trying again. This can get somewhat annoying. I also thought that the BruteFIR configuration is unnessecarily complicated.
I have also been using the excellent tool EqualizerAPO that does all I want, but it's for Windows only.

When using Alsa for both input and output, CamillaDSP can work almost as a drop-in replacement for BruteFIR. I run a 2048 tap stereo 2-way crossover at 44.1kHz, and this consumes less than 2% of a single cpu core on my HTPC (dual core Intel Skylake).

To help with configuration CamillaDSP checks the configuration and tries to give helpful error messages when there is a problem. In addition there is a Python script to visualize the whole pipeline from a config file.

Sample output:
https://github.com/HEnquist/camillad...r/pipeline.png

To try it, download a pre-built binary for your system from the "Releases" page:. Click "Assets" to view the available files.

Instead of using a pre-built binary it can also be built from source. The "Cargo" tool makes this very easy as it will download and compile all dependencies automatically. See more instructions in the README.

CharlieLaub 18th February 2020 08:27 PM

Wow, very impressive! That really looks like a nice piece of work.

Couple of questions:
How are you implementing the FIR convolution (e.g. using what library, it was handcoded, etc.).?
How do you account for different latencies of different FIR filters, and if you have many filter blocks on one path from input to output versus another path?

HenrikEnquist 18th February 2020 09:24 PM

Thanks!
The convolution is done with the overlap-add method and it's using RustFFT for fft/ifft: GitHub - awelkie/RustFFT: A mixed-radix FFT library written in pure Rust

The processing is done on chunks of audio data. The capture device captures let's say 1024 frames, and then passes this chunk to the processing thread. This then applies all filtering, mixing etc before passing it on to the playback device. This means that there will always be a delay of 1024 samples, plus a little bit more for the time the processing takes. In this case the fir filter can be up to 1024 taps but no more. For longer filters a larger chunk size is needed.

If there are different FIR filters for different channels, they need to be matched so they have the same latency. It would also be ok to add a simple delay to a channel to make up for a shorter FIR latency. I guess that in most cases a crossover will be designed in matched pairs, so there is no relative delay between the high- and lowpass filters. But if you then add a FIR room correction to only the LF channels, the HF will be too early and needs a delay. This isn't done automatically.

Simofil 19th February 2020 01:56 PM

Awesome Work!
One question:
Is it possible to NOT use a loopback interface and read stream directly from /dev/stdin and send the output to /dev/stout just like BruteFIR?

HenrikEnquist 19th February 2020 06:06 PM

I haven't needed stdin/stdout so I haven't implemented that yet. But I will! Probably quite soon.

Simofil 19th February 2020 07:41 PM

Quote:

Originally Posted by HenrikEnquist (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6090811.html#post6090811)
I haven't needed stdin/stdout so I haven't implemented that yet. But I will! Probably quite soon.

That would be awesome; I'll keep an eye on your repo ;) Thanks for the work!

HenrikEnquist 19th February 2020 09:04 PM

Quote:

Originally Posted by Simofil (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6090906.html#post6090906)
That would be awesome; I'll keep an eye on your repo ;) Thanks for the work!

Take a look now! The new version is in the branch "fileio" for now. Once I have tested it a little more I will merge to master.

Jona66 23rd February 2020 04:35 PM

Got it running on a headless Debian / Mopidy / Mopidy-Spotify & File player, easy to configure and handle! Doing convolution with rephase-generated filters.

Great, thank you for this nice piece of software!

Jo

HenrikEnquist 23rd February 2020 07:42 PM

Quote:

Originally Posted by Jona66 (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6095503.html#post6095503)
Got it running on a headless Debian / Mopidy / Mopidy-Spotify & File player, easy to configure and handle! Doing convolution with rephase-generated filters.

Great, thank you for this nice piece of software!

Jo

Thanks for the feedback!

Just out of curiosity, how long filters do you have, what samplerate, and many channels are you outputting? And are you using the Alsa backend?

Jona66 23rd February 2020 07:51 PM

Filter is 16384 taps, 2 channels, 48khz, running on an Intel Celeron J3160, approx. 5% CPU load. CPU load is pretty much the same than Brutefir, delay is much shorter.

Kr
J


All times are GMT. The time now is 05:40 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 17.65%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright ©1999-2020 diyAudio

Wiki