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)

jensgk 18th April 2021 06:32 PM

Suggested change for headphone calibration
 
Hi Henrik and CamillaDSP community,

I really appreciate your great work with CamillaDSP. Tack så mycket!

Since your library is so comprehensive and fleksible, I think (and hope) that it
will become a unifying standard in open source DSP. Moode Player has
already adapted it, and I hope that others will follow soon.

You are probably already aware of the work being done with regard to headphone
EQ (calibration), where it has become the new trend to calibrate your headphones
in order to get a perfect frequency response.

More on this here:
GitHub - jaakkopasanen/AutoEq: Automatic headphone equalization from frequency responses
and here:
oratory1990 - for questions about acoustics

As you can see from the following (below), EQ tables for headphones are often
specified with peaking, low_shelf and high_shelf specifications. Unfortunately
the shelf filters are often shown with the parameters Frequency, Gain and
Q value, which makes it difficult to use CamillaDSP, since Q values are not
supported i high/low shelf filters.

An example (not my headphones or submission)
CamillaDSP IIR filters : oratory1990
CamillaDSP Config example for Beyerdynamics DT 770 Pro * GitHub

Example headphone EQ presets:
index/list_of_presets - oratory1990
and here (one of the more popular headphones):
https://www.dropbox.com/s/r7wa83eb53...-M50x.pdf?dl=0

So I would hear if you would consider to make an ekstra high_shelf/low_shelf
filter, that accepts the Q parameter instead of the Slope parameter.

As far as I can see (I am no expert), from:
https://www.musicdsp.org/en/latest/_...Q-Cookbook.txt

that would entail to make (something like) the following changes in new copies of
the functions config::BiquadParameters::Highshelf, and
config::BiquadParameters::Lowshelf (in biquad.rs)

Old line:
let alpha = sn / 2.0 * ((ampl + 1.0 / ampl) * (1.0 / (slope / 12.0) - 1.0) + 2.0).sqrt();

New line (Q is the new parameter):
let alpha = sn / (2.0 * Q);

I don't know if that is correct, or if you think it is a good idea, but it
would make life easier for headphone enthusiasts :-)

Any way, changes or not, CamillaDSP is definitely still a great thing, also
for headphone calibration!

Best regards
Jens

HenrikEnquist 18th April 2021 08:29 PM

Quote:

Originally Posted by emailtim (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6622053.html#post6622053)
What are the chances of adding an optional analyzer/monitor window to show the realtime outputs of each filtered channel ?

It could be used to very XOs on each channel with some pink noise playback.
TIA

The chances are unfortunately quite small. To do this with decent performance, all the processing would have to be done in the camilladsp process. This would add quite a bit of complexity, and increase cpu usage. And that goes against my goal of keeping the dsp engine slim.

Quote:

Originally Posted by jensgk (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6622256.html#post6622256)
So I would hear if you would consider to make an ekstra high_shelf/low_shelf
filter, that accepts the Q parameter instead of the Slope parameter.

So there are several ways to define 2nd order filters. The most common for shelves are Q and Slope, but I have seen Bandwidth as well. And there are probably other ways in use somewhere as well.
Instead of supporting all that, I have chosen to limit so there is a single way to define each filter type. This makes it much easier to avoid bugs, and I really prefer to keep it like this. All filter types must be supported by camilladsp, the gui, and the pycamilladsp-plot library, so there are plenty of opportunities for bugs to sneak in.

The Audio EQ cookbook gives a simple formula for going from slope to Q:

Code:

1/Q = sqrt((A + 1/A)*(1/S - 1) + 2)
Where:
Code:

S = slope/12
A  = 10^(gain/40)

Going the other way, from Q to slope, isn't very difficult.
I get this (unverified!):
Code:

slope = 12/((1/Q^2 - 2.0)/(A + 1/A) + 1.0)
It can probably be simplified a bit more.

jensgk 18th April 2021 09:14 PM

Quote:

Originally Posted by HenrikEnquist (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6622380.html#post6622380)
So there are several ways to define 2nd order filters. The most common for shelves are Q and Slope, but I have seen Bandwidth as well. And there are probably other ways in use somewhere as well.
Instead of supporting all that, I have chosen to limit so there is a single way to define each filter type. This makes it much easier to avoid bugs, and I really prefer to keep it like this. All filter types must be supported by camilladsp, the gui, and the pycamilladsp-plot library, so there are plenty of opportunities for bugs to sneak in.

Hi Henrik,

Thanks for the very quick reply!

I completely understand the desire to keep it complete and simple, - and that is probably also why CamillaDSP has so much traction at the moment.

I am, for my part, just happy that you are doing what you doing.

I just hope, that someone would consider making a CamillaDSP preprocessor, that could enhance some of the filter definitions, add variables and arithmetic expression expressions, etc. and then "compile" it to basic CamillaDSP config files. Well, just an idea, anyway.

Best regards
Jens

emailtim 18th April 2021 10:50 PM

Quote:

Originally Posted by HenrikEnquist (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6622380.html#post6622380)
The chances are unfortunately quite small. To do this with decent performance, all the processing would have to be done in the camilladsp process. This would add quite a bit of complexity, and increase cpu usage. And that goes against my goal of keeping the dsp engine slim.

That is understandable and makes sense. How about an alternative like writing to an alternate target, tee or file so the results could be post processed / analyzed in another program ? It would be a good way to document the filter results even if it is just a snapshot in time.

Can CamillaDSP currently write N-channels to a file ?

HenrikEnquist 19th April 2021 07:09 AM

Quote:

Originally Posted by emailtim (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6622516.html#post6622516)
Can CamillaDSP currently write N-channels to a file ?

It can write any number of channels to a raw file. Just not at the same time as when outputting to for example an Alsa device.



Quote:

Originally Posted by jensgk (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6622425.html#post6622425)
I just hope, that someone would consider making a CamillaDSP preprocessor, that could enhance some of the filter definitions, add variables and arithmetic expression expressions, etc. and then "compile" it to basic CamillaDSP config files. Well, just an idea, anyway.

That seems like a reasonable idea, and could be fun to write. I will probably never find the time, but maybe someone else wants to try? Then I would suggest to use Python with PyYAML: https://pyyaml.org/wiki/PyYAMLDocumentation
For arithmetic expressions etc, check out pyparsing:

Welcome to PyParsing’s documentation! — PyParsing 3.0.0b2 documentation

jrubins 19th April 2021 08:54 PM

Quote:

Originally Posted by HenrikEnquist (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6621977.html#post6621977)
It's just a new config option on the capture device, see here:
GitHub - HEnquist/camilladsp at develop

The default to use the old mode, so you don't need to change your config.

It works great for me, thanks!

TNT 19th April 2021 08:58 PM

Henrik, is it possible to keep the display order of defined Filters? Once entered and then if reloaded, filters are ordered in a different way - randomly seemingly...?

//

jrubins 19th April 2021 09:36 PM

3 Attachment(s)
Now that everything is fully functional again (thanks Henrik!!), I can get back to feature requests/bugs/questions :D
I'm still having trouble with free biquads. When I go to biquad designer that you reference in your code, I'm still not getting the same output (visually) that I would expect.
No filter where I put in a1, a2, b0, b1, b2 looks anything like I expect it to. That could be because the visualization is not working as intended, or because the biquad engine isn't, or (this does seem probable) I'm doing something wrong :D
Take a look at the attached screenshots and let me know if there's something incorrect. When I do an FIR filter for RIAA correction, it looks spot-on, BTW. Other biquads like low shelf and crossover curves also look correct. Just something with "free" biquads.

feature requests:
you can select a remote file when you choose an FIR filter, but not for the configuration. Would be a lot cooler if you could ;)

Would love to be able to add filters/mixers above or below on the pipeline. That way it's easy to add things before some other thing.

A question: can I upload FIR filters as WAV or FLAC files as well as text? It seems like I can given the options of "format" but I just wanted to check

Finally, a compliment: this is a really well-executed DSP tool and seems to do a really nice job. Thanks!

HenrikEnquist 20th April 2021 07:02 AM

Quote:

Originally Posted by jrubins (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6623808.html#post6623808)
It works great for me, thanks!

Thanks! Then I will release this version as final 0.5.0.


Quote:

Originally Posted by TNT (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6623816.html#post6623816)
Henrik, is it possible to keep the display order of defined Filters? Once entered and then if reloaded, filters are ordered in a different way - randomly seemingly...?
//

The data structure that stores the filter configs doesn't guarantee to preserve the order, for performance reasons I suppose. Best we can do is to sort alphabetically, then it at least becomes predictable.


Quote:

Originally Posted by jrubins (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6623860.html#post6623860)
I'm still having trouble with free biquads. When I go to biquad designer that you reference in your code, I'm still not getting the same output (visually) that I would expect.

There seems to be some bug in the plotting, I'll look at it.
You can use this in the meanwhile (if you swap a and b):
Filter frequency response grapher | EarLevel Engineering


Quote:

Originally Posted by jrubins (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6623860.html#post6623860)
feature requests:
you can select a remote file when you choose an FIR filter, but not for the configuration. Would be a lot cooler if you could ;)

Would love to be able to add filters/mixers above or below on the pipeline. That way it's easy to add things before some other thing.

Both of these are already done and will be available in the next gui release!



Quote:

Originally Posted by jrubins (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6623860.html#post6623860)
A question: can I upload FIR filters as WAV or FLAC files as well as text? It seems like I can given the options of "format" but I just wanted to check

FLAC (or any other compressed format) isn't supported. WAV kindof is, since you can read the audio data inside as raw data. The new gui will have some logic to help out with the settings for that, but only for single-channels wav files. I will add proper reading of wav for coefficient files in the next camilladsp version.



Quote:

Originally Posted by jrubins (https://www.diyaudio.com/forums/pc-based/349818-camilladsp-cross-platform-iir-fir-engine-crossovers-correction-etc-post6623860.html#post6623860)
Finally, a compliment: this is a really well-executed DSP tool and seems to do a really nice job. Thanks!

Thanks!

pelanj 20th April 2021 08:28 AM

Hi Henrik, yesterday I tried to install CamillaDSP on a fresh install of minimal Debian. I cloned the git repository and tried to compile. I installed the missing packages that the compile process reported during compilation and I was able to make it to 2 or 3 steps before the last one (something like 138 of 141). It reported two errors with numbers (I forgot to take a picture, I thought I did). One of them was reporting some wrong use of function and the other one something with nightly build of rust and some suggestion to fix it. I am just a slightly advanced Linux noob, but I have already used git and compiled successfully a few programs with the help of google. Could it be that some packages are too new to compile? Do you have any idea what might be wrong? Tonight, I think I will try to install the latest precompiled beta instead. It is a HP T510 thin client that I plan to use as an AirPlay receiver, experimenting with DRC and later also with 2x4 crossover.

Edit: I think it is the same error as in this post: https://www.diyaudio.com/forums/pc-b...ml#post6400206

I need to update rust, since it will still be an old version in the repository.


All times are GMT. The time now is 11:27 AM.


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

Wiki