Re: Directly setting biquad coefficients

Hello Raymond,

Wednesday, October 8, 2014, 5:22:55 PM, you wrote:

> Chris and I were discussing the possibility of allowing a user to
> set the coefficients of a biquad filter directly, as mentioned in
> https://github.com/WebAudio/web-audio-api/issues/323

That is probably useful (provided it isn't the only way to specify a
biquad filter).

> This ability makes it possible to have a first-order filter, which
> isn't possible now. This also makes it easier to create higher-order
> filters from biquads where you've decomposed the filter into a set
> of biquads with the coefficients.

For example, a 48dB/octave 20kHz filter to tame above-Nyquist
harmonics and thus reduce aliasing before it hits the DAC.

>  No need to convert each biquad
> into a lowpass, bandpass, and highpass filter with appropriate frrequency and Q values.


> We think this is a good idea, but were not sure on exactly how to expose this.
> Should we have setCoefficients(b0,b1,b2,a1,a2) create a "custom" filter type?

Probably the best.

However, the spec should be clear on what a and b means because I have
seen tutorials and online biquad calculators that use a and b the
other way round (a0, a1, a2, b1, b2).

> This would preclude any kind of automation.

Yes. On the other hand, automation is better done on frequency and
Q. And its not clear (at least to me) whether its possible to have a
smoothly automatable filter slope (without faking it with two filters
and a crossfader).

> The values of frequency,
> Q, gain would be undefined (in some way) for this filter type.

Not undefined exactly but not directly discoverable/modifiable either
9I think. Excuse my ignorance. Does any arbitrary biquad have a
defined Q and frequency? Or are those only defined for a subset of
possible inputs?)

> Should the individual coefficients be exposed as audioparams?
> We couldn't come up with an actual use-case where any one would
> want, say, a linear ramp for, say, coefficient a1. Some possibly
> interesting filtering affects might be possible.

The only time I have seen matrix values animated was in SVG for 2D
transformations, and that was done by decomposing the matrix into
equivalent primitives (in that case translations, rotation, etc),
animating those, and stuffing the results back into a matrix.

Depending on the answer to my earlier question, that approach might be
an option here?

-- 
Best regards,
 Chris Lilley, Technical Director, W3C Interaction Domain

Received on Wednesday, 8 October 2014 15:50:44 UTC