What are the units for the rolloff parameter for the Elliptic filter in the DSPFilter library?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS
rthornthwaite
KVRer
Topic Starter
3 posts since 9 Jun, 2023

Post Fri Jun 09, 2023 12:32 pm

I am trying to make a lowpass elliptic filter. My signal is sampled at 10 Hz. I want to start the cutoff at .5 Hz. I want it to be 80dB down at 1 Hz. I am working on Linux, so I did not build all the demo code. I tried to put 80 in for the rolloff parameter. That did not work. It has to be a much smaller number. Does this code work?

Thank you.

juha_p
KVRian
819 posts since 21 Feb, 2006 from FI

Post Fri Jun 09, 2023 8:59 pm

rthornthwaite wrote: Fri Jun 09, 2023 12:32 pm I am trying to make a lowpass elliptic filter. My signal is sampled at 10 Hz. I want to start the cutoff at .5 Hz. I want it to be 80dB down at 1 Hz. I am working on Linux, so I did not build all the demo code. I tried to put 80 in for the rolloff parameter. That did not work. It has to be a much smaller number. Does this code work?

Thank you.
On Matlab, something like :
elllpf.png
If you don't have Matlab in hands, to tweak it suitable for you, read the function description and then adjust the parameters in example at https://se.mathworks.com/help/signal/ref/ellip.html (run the example there and edit).
You do not have the required permissions to view the files attached to this post.

User avatar
mystran
KVRAF
7664 posts since 12 Feb, 2006 from Helsinki, Finland

Post Sat Jun 10, 2023 12:13 am

rthornthwaite wrote: Fri Jun 09, 2023 12:32 pm I am trying to make a lowpass elliptic filter. My signal is sampled at 10 Hz. I want to start the cutoff at .5 Hz. I want it to be 80dB down at 1 Hz. I am working on Linux, so I did not build all the demo code. I tried to put 80 in for the rolloff parameter. That did not work. It has to be a much smaller number. Does this code work?
Do you mean https://github.com/vinniefalco/DSPFilters?

There seems to be an open ticket with people wondering what the parameters are supposed to mean exactly...
I'm a useless animal with no marketable skills, besides writing code and thinking DSP. Hire me as a mascot or a pet?

juha_p
KVRian
819 posts since 21 Feb, 2006 from FI

Post Sat Jun 10, 2023 4:10 am

By quick look at the DSPFilter source code, it might be transition width value in question.

Transition width = Width from the edge of the passband to the edge of the stopband.

https://ccrma.stanford.edu/~jos/sasp/Lo ... tions.html

rthornthwaite
KVRer
Topic Starter
3 posts since 9 Jun, 2023

Post Mon Jun 12, 2023 5:54 am

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
juha_p wrote: Fri Jun 09, 2023 8:59 pm
On Matlab, something like :

elllpf.png

If you don't have Matlab in hands, to tweak it suitable for you, read the function description and then adjust the parameters in example at https://se.mathworks.com/help/signal/ref/ellip.html (https://se.mathworks.com/help/signal/ref/ellip.html) (run the example there and edit).
I have Matlab, but I am a beginner with it. I did design the filter with Matlab. I need C++ code to implement it in my application. I read that it may be possible to have Matlab generate the C++ code. I am looking into how to use Matlab to generate the C++ code.
Last edited by rthornthwaite on Mon Jun 12, 2023 8:30 am, edited 1 time in total.

rthornthwaite
KVRer
Topic Starter
3 posts since 9 Jun, 2023

Post Mon Jun 12, 2023 6:55 am

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
juha_p wrote: Sat Jun 10, 2023 4:10 am By quick look at the DSPFilter source code (https://github.com/vinniefalco/DSPFilters/blob/master/shared/DSPFilters/source/Param.cpp), it might be transition width value in question.

Transition width = Width from the edge of the passband to the edge of the stopband.

https://ccrma.stanford.edu/~jos/sasp/Lo ... tions.html (https://ccrma.stanford.edu/~jos/sasp/Lowpass_Filter_Design_Specifications.html)
The parameter I am having trouble with is "rolloff." I found this definition: The rolloff rate is the filter output change rate versus frequency. It is expressed as a loss per decade (a ten-times increase in frequency) or per octave (a two-time increase in frequency. I want the filter to be 80 dB down, going from .5 Hz to 1 Hz. So that would be 80 dB per octave. The transition width is 1 octave, but that is only meaningful when we specify what the attenuation should be over that width.

juha_p
KVRian
819 posts since 21 Feb, 2006 from FI

Post Mon Jun 12, 2023 7:52 am

rthornthwaite wrote: Mon Jun 12, 2023 6:55 am The parameter I am having trouble with is "rolloff." I found this definition: The rolloff rate is the filter output change rate versus frequency. It is expressed as a loss per decade (a ten-times increase in frequency) or per octave (a two-time increase in frequency. I want the filter to be 80 dB down, going from .5 Hz to 1 Hz. So that would be 80 dB per octave. The transition width is 1 octave, but that is only meaningful when we specify what the attenuation should be over that width.
Aren't transition width units in Hz (or rad/s ?) rather than in octaves?
transition-width i.2.1.jpeg
Also, if you set rolloff = 0.5 (Hz) then is the result OK?
You do not have the required permissions to view the files attached to this post.

User avatar
mystran
KVRAF
7664 posts since 12 Feb, 2006 from Helsinki, Finland

Post Mon Jun 12, 2023 10:26 am

juha_p wrote: Mon Jun 12, 2023 7:52 am Aren't transition width units in Hz (or rad/s ?) rather than in octaves?
Also, if you set rolloff = 0.5 (Hz) then is the result OK?
For a given cutoff you can convert transition width in Hz to octaves and vice versa. For an analog filter, if you scale the cutoff without changing anything else, the transition width stays the same in terms of octaves. For a digital (BLT) filter frequency warping applies as usual, so the fixed transition bandwidth in octaves only really holds approximately at low frequencies.

The thing to keep in mind though is that for a given order the transition bandwidth is a function of the passband and stopband ripple factors. If you want to specify all three, you typically have to try different orders until you find one that satisfies the requirements.

I really wish I could help more with this... but elliptic filters are a bit complicated and I've mostly forgotten the details of how to design them. Vadim has a treatment in The Art of VA Filter Design if I recall correctly. Alternatively if you can get Matlab to decompose a design into biquads (for a numerically stable implementation), then that's an option too.. but I never bothered learning Matlab.
I'm a useless animal with no marketable skills, besides writing code and thinking DSP. Hire me as a mascot or a pet?

juha_p
KVRian
819 posts since 21 Feb, 2006 from FI

Post Mon Jun 12, 2023 11:48 am

mystran wrote: Mon Jun 12, 2023 10:26 am
...

The thing to keep in mind though is that for a given order the transition bandwidth is a function of the passband and stopband ripple factors. If you want to specify all three, you typically have to try different orders until you find one that satisfies the requirements.

I really wish I could help more with this... but elliptic filters are a bit complicated and I've mostly forgotten the details of how to design them. Vadim has a treatment in The Art of VA Filter Design if I recall correctly. Alternatively if you can get Matlab to decompose a design into biquads (for a numerically stable implementation), then that's an option too.. but I never bothered learning Matlab.
Yes, order and ripple settings matters.

Regarding design of elliptic filters, Sophocles J. Orfanidis gives some details in his : Lecture Notes on Elliptic Filter Design

Other reading regarding those design parameter's: M. Vlcek and R. Unbehauen : Degree, ripple, and transition width of elliptic filters

Return to “DSP and Plugin Development”