Page 1 of 1

BiQuadFilter

Posted: Thu Apr 25, 2019 3:07 pm
by Benard
Is it possible to get some information about the BiQuadFilter in the MD library?

BiQuadFilter(FilterType type, double frequency, double gain)

I see the constructor requires a FilterType, but it's not clear to me what the options for type are. I also see no method for getting its value, such as GetLowpassValue() in AnalogFilter.

Any help would be appreciated.

Re: BiQuadFilter

Posted: Thu Apr 25, 2019 4:32 pm
by Cherry Dan
Benard,

Biquad filters are simple two-pole filters that are often combined together to create more complex filters. If you look ion the Enumerations section of the Library tab in Voltage Module Designer, you'll find the BiQuadFilter.FilterType enumeration.

Here's an example of a lowpass filter at 4,000 Hz:

BiQuadFilter lowpassFilter = new BiQuadFilter(BiQuadFilter.FilterType.LOWPASS, 4000.0, 0);

Here's an example of a notch filter, at 10,000 Hz, with a bandwidth of 1 octave:

BiQuadFilter notchFilter = new BiQuadFilter(BiQuadFilter.FilterType.NOTCH, 10000, 0, 1.0);

To use a BiQuadFilter you've created, just call ProcessSample() on it:

double outputSignal = lowpassFilter.ProcessSample(inputSignal);

Please let us know if you have any further questions!

Thanks,
Dan

Re: BiQuadFilter

Posted: Sun Apr 28, 2019 11:04 am
by Benard
Ah, that's great, just the info I needed! Thanks Dan!

Re: BiQuadFilter

Posted: Mon May 13, 2019 3:25 am
by terrymcg
Hi Dan...
Cherry Dan wrote: Thu Apr 25, 2019 4:32 pm
Here's an example of a notch filter, at 10,000 Hz, with a bandwidth of 1 octave:

BiQuadFilter notchFilter = new BiQuadFilter(BiQuadFilter.FilterType.NOTCH, 10000, 0, 1.0);

[ . . . ]

Please let us know if you have any further questions!

Thanks,
Dan
I have some additional bi-quad questions for you...

What's the 'slope' of these filters? Specifically, the low, high, and bandpass bi-quads?

The gain parameter : What units/range of values is expected? The set/get method names suggest dB, if so, are there min/max values? Or is it some other unit?

The bandwidth parameter : I assume it applies to FilterType.BANDPASS as well as FilterType.NOTCH?

And it sure would be nice to be able to specify the bandwidth in Hz... many tedious calculations later I think I have the specific widths I wanted figured out ;)

Thanks in advance!

Cheers,
--
Terry McG

Re: BiQuadFilter

Posted: Fri May 17, 2019 3:00 am
by terrymcg
In case others are curious, what I've learned so far...
terrymcg wrote: Mon May 13, 2019 3:25 am The gain parameter : What units/range of values is expected? The set/get method names suggest dB, if so, are there min/max values? Or is it some other unit?
It is dB, but Googling suggests it's only used by shelf/peak filters (http://shepazu.github.io/Audio-EQ-Cookb ... kbook.html)
terrymcg wrote: The bandwidth parameter : I assume it's applies to FilterType.BANDPASS as well as FilterType.NOTCH?
Yes, it does :)

Cheers,
--
Terry McG