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

In CamillaDSP the shelves are specified with gain, frequency and slope, so making a 1dB per octave slope is easy. The result is the same as setting a very low Q, but I haven't made it possible to specify shelves with Q instead of slope.
Is there a need for this?
On the same topic, for peaking, notch and bandpass etc, is there a need for specifying bandwidth instead of Q?

Q is really very common - I vote to incorporate Q - also.

Well, if not for that e.g. REWs EQ function outputs F, Q and Gain. I'd go so far that I think it would be nice if Camilla could import the files that function exports - i.e. a text list of biquads. See attachment... Slope is also good 🙂

Filter Settings file

Room EQ V5.19
Dated: Jul 28, 2020 10:48:56 AM

Notes:G2 filts

Equaliser: rePhase
Jul 25 23:18:01
Filter 1: ON PK Fc 297 Hz Gain -5.9 dB Q 2.580
Filter 2: ON PK Fc 406 Hz Gain 2.5 dB Q 2.610


//
 

Attachments

Last edited:
Rephase uses constant Q by default and that is what REW uses when in that mode. The generic equalizer is different again. Matching the Q of any equaliser is quite a difficult task unless the method is disclosed. I have done it a few times and it is a real time waster.

Proportional Q looks much like constant at low boost but is completely different with high boost.

Biquads avoid this problem as they specify the coefficients directly.
 
Not many has the ability to think about an EQ need and churn out a biquad by just doing the math in the head :-D so some tool is needed. My example just happen to have rephase as a target - but I do appreciate tge problem with different definition of what a biquad should do - strange really - isn't there a standard for this?

//
 
..This means that somewhere there is a string that can't be interpreted as a number. Most likely this is in one of the coefficient files. Can you post your highpass.txt and lowpass.txt?

I did copy/paste from your
../camilladsp-0.3.1/exampleconfigs/all_biquads

highpass.txt:
Code:
filters:
  highpass:
    type: Biquad
    parameters:
      type: Highpass
      freq: 1000
      q: 1.0
lowpass.txt:
Code:
filters:
   lowpass:
    type: Biquad
    parameters:
      type: Lowpass
      freq: 1000
      q: 1.0
I tried to insert some errors in highpass.txt
like "freq: aaa" or "filtersqq:"

but results ever:
"invalid float literal".

I tried also to hide highpass.txt, then:
"No such file or directory (os error 2)".

I think that "invalid float literal" was found in alsaconfig.yml before Filter section.
 
Aha, that makes it's obvious what the problem is!


The "Conv" filter is for FIR filters, and the contents of the txt-file should be just a list of the filter coefficients. Not another filter definition in yml-format.


Try this config:

Code:
 [FONT=Courier New]---[/FONT]
[FONT=Courier New]devices:[/FONT]
[FONT=Courier New]  samplerate: 44100
[/FONT]
[FONT=Courier New]  buffersize: 1024
[/FONT]
[FONT=Courier New]  capture:
    type: Alsa
[/FONT][FONT=Courier New]    channels: 2[/FONT]
[FONT=Courier New]    device: "hw:Loopback,1"[/FONT][FONT=Courier New]
[/FONT]
[FONT=Courier New]    format: S16LE[/FONT][FONT=Courier New]
[/FONT]
[FONT=Courier New]  playback:[/FONT][FONT=Courier New]
[/FONT]
[FONT=Courier New]    type: Alsa[/FONT][FONT=Courier New]
[/FONT]
[FONT=Courier New]    channels: 2[/FONT][FONT=Courier New]
[/FONT]
[FONT=Courier New]    device: "hw:3,0"[/FONT][FONT=Courier New]
[/FONT]
[FONT=Courier New]    format: S16LE[/FONT]

[FONT=Courier New] 

filters:
   highpass:
    type: Biquad
    parameters:
      type: Highpass
      freq: 1000
      q: 1.0
  lowpass:
    type: Biquad
    parameters:
      type: Lowpass
      freq: 1000
      q: 1.0

pipeline:
  - type: Filter
    channel: 0
    names:
      - highpass
  - type: Filter
    channel: 1
    names:
      - lowpass[/FONT]
EDIT:what's wrong with code blocks today? No matter how many times I try, the formatting of the yml gets messed up when I save the post.. Check that the indentation gets right if you copy the config from here!
 
Last edited:
Siiii!
Funziona!

It is working!! Great!

It reports an error,
Code:
root@flavio-PC:/home/f/Scrivania/Scaricati/Camilla/camilladsp-config# camilladsp -v alsaconfig.yml
[2020-07-28T12:52:18Z DEBUG camilladsp] Read config file Some("alsaconfig.yml")
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.9289788754795872 b1=-1.8579577509591745 b2=0.9289788754795872
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.0047304174129274516 b1=0.009460834825854903 b2=0.0047304174129274516
[2020-07-28T12:52:18Z DEBUG camilladsp] Config is valid
[2020-07-28T12:52:18Z DEBUG camilladsp] Wait for config
[2020-07-28T12:52:18Z DEBUG camilladsp] Config ready
Buffer frames 2048
[2020-07-28T12:52:18Z DEBUG camillalib::filters] Build new pipeline
[2020-07-28T12:52:18Z DEBUG camillalib::filters] Build from config
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.9289788754795872 b1=-1.8579577509591745 b2=0.9289788754795872
[2020-07-28T12:52:18Z DEBUG camillalib::filters] Build from config
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.0047304174129274516 b1=0.009460834825854903 b2=0.0047304174129274516
[2020-07-28T12:52:18Z DEBUG camillalib::processing] build filters, waiting to start processing loop
[2020-07-28T12:52:18Z ERROR camilladsp] Playback error: ALSA function 'snd_pcm_open' failed with error 'EBUSY: Device or resource busy'
[2020-07-28T12:52:18Z DEBUG camilladsp] Exiting
Why?

But if I play a song, it sounds good.

I will do wonderful things.

I have many questions to ask, but first I have to do some tests hoping not to break my new toy.

Thank you!
 
Siiii!
Funziona!

It is working!! Great!

It reports an error,
Code:
root@flavio-PC:/home/f/Scrivania/Scaricati/Camilla/camilladsp-config# camilladsp -v alsaconfig.yml
[2020-07-28T12:52:18Z DEBUG camilladsp] Read config file Some("alsaconfig.yml")
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.9289788754795872 b1=-1.8579577509591745 b2=0.9289788754795872
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.0047304174129274516 b1=0.009460834825854903 b2=0.0047304174129274516
[2020-07-28T12:52:18Z DEBUG camilladsp] Config is valid
[2020-07-28T12:52:18Z DEBUG camilladsp] Wait for config
[2020-07-28T12:52:18Z DEBUG camilladsp] Config ready
Buffer frames 2048
[2020-07-28T12:52:18Z DEBUG camillalib::filters] Build new pipeline
[2020-07-28T12:52:18Z DEBUG camillalib::filters] Build from config
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.9289788754795872 b1=-1.8579577509591745 b2=0.9289788754795872
[2020-07-28T12:52:18Z DEBUG camillalib::filters] Build from config
[2020-07-28T12:52:18Z DEBUG camillalib::biquad] a1=-1.8484969161333196 a2=0.8674185857850293 b0=0.0047304174129274516 b1=0.009460834825854903 b2=0.0047304174129274516
[2020-07-28T12:52:18Z DEBUG camillalib::processing] build filters, waiting to start processing loop
[2020-07-28T12:52:18Z ERROR camilladsp] Playback error: ALSA function 'snd_pcm_open' failed with error 'EBUSY: Device or resource busy'
[2020-07-28T12:52:18Z DEBUG camilladsp] Exiting
Why?

But if I play a song, it sounds good.

I will do wonderful things.

I have many questions to ask, but first I have to do some tests hoping not to break my new toy.

Thank you!
I would guess that pulseaudio is blocking the device. Are playing music with some desktop app? Then most likely you are just hearing sound from pulseaudio directly, without camilladsp.
Take a look here for how to set up pulseaudio to send sound to the loopback. GitHub - HEnquist/camilladsp-config: Help for setting up CamillaDSP, example config files etc
 
..Then most likely you are just hearing sound from pulseaudio directly, without camilladsp
No, it's all ok.
I can ear the filters effect:
no bass frequencies on right channel and no high frequencies on the left (or the other way around).
The sound is clean.

Now I don't have time to continue, but then I go back there.

Thank you jiiteepee.
The problem was really "type: Conv".
 
Thanks - is there also a command in the Terminal?

//
No it's only meant as an example to show how to use cpal. It just happens to be useful as a stand alone tool 🙂

No, it's all ok.
I can ear the filters effect:
no bass frequencies on right channel and no high frequencies on the left (or the other way around).
The sound is clean.

Now I don't have time to continue, but then I go back there.

Thank you jiiteepee.
The problem was really "type: Conv".
So camilladsp is definitely running then! Was it perhaps started by systemd?
 
The error message should be a lot more detailed. Instead of "invalid string literal" it shoud say something like "Can't read number on line 123 of file somefile.txt" I'll fix that in the next version!
This is the improved error message from what will become release 0.3.2:
[2020-07-28T19:32:46Z ERROR camilladsp] Can't parse value on line 18 of file 'filter_broken.txt', error: invalid float literal
 
Q is really very common - I vote to incorporate Q - also.

Well, if not for that e.g. REWs EQ function outputs F, Q and Gain. I'd go so far that I think it would be nice if Camilla could import the files that function exports - i.e. a text list of biquads. See attachment... Slope is also good 🙂

Filter Settings file

Room EQ V5.19
Dated: Jul 28, 2020 10:48:56 AM

Notes:G2 filts

Equaliser: rePhase
Jul 25 23:18:01
Filter 1: ON PK Fc 297 Hz Gain -5.9 dB Q 2.580
Filter 2: ON PK Fc 406 Hz Gain 2.5 dB Q 2.610


//
Ok I'll add a way to specify shelves also with Q.
The REW syntax for defining filters is IMHO horrible to work with.. To handle all the possible different filter types with their different parameters, you need a gigantic tree of ifs, else-ifs and elses. No thanks! 🙂


Rephase uses constant Q by default and that is what REW uses when in that mode. The generic equalizer is different again. Matching the Q of any equaliser is quite a difficult task unless the method is disclosed. I have done it a few times and it is a real time waster.

Proportional Q looks much like constant at low boost but is completely different with high boost.

Biquads avoid this problem as they specify the coefficients directly.
Constant Q is the only one I plan to support at the moment. I have only seen descriptions of proportinal Q solutions, no formulas. But I haven't spent any time searching.
 
OK!

Currently I use this to create BQs: .xls

Is there a brute 5 coefficient biquad input possibility in Camilla now? I live in the notion that if one can enter this way, one can enter any filter really, even Linqwitz transforms...?

//
 
OK!

Currently I use this to create BQs: .xls

Is there a brute 5 coefficient biquad input possibility in Camilla now? I live in the notion that if one can enter this way, one can enter any filter really, even Linqwitz transforms...?

//
Yes there is "Free" Biquad where you just give the coefficients. There is one thing to watch out for: MiniDSP uses the opposite sign of a1 and a2 compared to pretty much everyone else. To use coefficients meant for a MiniDSP, just flip the sign of a1 and a2.


Linkwitz transform is already built in!
LinkwitzTransform
  • A Linkwitz transform to change a speaker with resonance frequency freq_act and Q-value q_act, to a new resonance frequency freq_target and Q-value q_target.
 
Hi Henrik.
I had made the mistake of defining a biquad filter as a * .txt file, writing:
"type: Conv" (convolution?)
but this definition is reserved for FIR filters.
And it seemed very natural to me that it was possible.
I invite you to consider changing "Conv" to "FIR", then
"type: FIR",
to inaugurate the new type:
"type: IIR".
This would make it easier to write filters from an editor application, since the position of the definition lines would be fixed.
I am quite skilled (bravo) with Execel sheets.
It is easy to have a graphic response of each set of filters and the resulting sum of all.
It is easy to import and superimpose reference curves and frequency responses.
Conversion factors for shelf filters can be introduced to transform the slope into Q and Q into other Q.
An Execell sheet can be friendly if it's well done.
I want do it
It is a great commitment for me and I would be happy to share its development and verification.
I'm sure many of you are more skilled than I am.
 
Hi,
Yes Conv means Convolution, I shortened it because I thought the word was a bit long in the config.
I don't understand where you want to change to FIR, could you write an example of how you want it to look?

There are several types of IIR filters, they are Biquad, BiquadGroup and DiffEq. If I rename to IIR I would need to add another level to specify which type of IIR.

I want to keep the configuration in one file as much as possible. The fir coefficients are the necessary exception, but the rest should really be in one file. Splitting into several files causes a lot of trouble for example when sending configs via the websocket. It also makes it difficult when using python to manage the config. In python you can easily load a config into a python object, modify values, add or remove filters etc, and then export it as a new yaml file.

Is it possible to handle yaml in Excel? Perhaps you could make something that generates a text block for a filter, ready to be copy pasted into thd yaml.
 
I have been playing around a bit more on the Mac, and have had some trouble with the BlackHole virtual sound card. Sometimes it doesn't work to capture audio from it. It happens both with CamillaDSP and the record_wav example from Cpal.
I don't know if the bug that causes this is in BlackHole or Cpal, but using Soundflower instead of BlackHole seems to make the problem go away.
Did anyone else have problems with BlackHole?