Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IIRFilter feedback/feedforward array length limitations #1153

Closed
tambien opened this issue Feb 22, 2017 · 2 comments
Closed

IIRFilter feedback/feedforward array length limitations #1153

tambien opened this issue Feb 22, 2017 · 2 comments

Comments

@tambien
Copy link

tambien commented Feb 22, 2017

I would like to be able to use the IIRFilterNode to create a Feedback Comb Filter and Lowpass Feedback Comb Filter. It seems like both are possible with this node type, but the limitation of 20 arguments in the input arrays, i believe, means that the maximum delay time of the IIRFilterNode is 20 samples. This would be too short a delay time to implement something like a Schroeder Reverb which requires a comb filter with a feedback delay of thousands of samples.

Feedback Comb Filters of this length are currently possible in the WAA with the DelayNode and a GainNode, but for applications like Karplus–Strong synthesis, the limitation of the minimum feedback delay time of 128 samples when a DelayNode's output is connected back to into its input makes the synth unable to produce any notes above a certain frequency. I think the IIRFilerNode would also be a good way to do Karplus-Strong, but again, the limitation of an array of length 20 doesn't make that possible either.

Maybe if the unit delay of each step were configurable with an array as a third argument. It would be ideal if that unit delay length could be more or less than one sample.

Any thoughts or insights are appreciated. Thanks.

@rtoy
Copy link
Member

rtoy commented Feb 22, 2017

While I'm not opposed to increasing the current limit from 20 to something a bit larger, I am opposed to increasing it to hundreds or thousands. In the general case, the computation becomes thousands of operations per output frame, even if your use case only has 2 non-zero coefficients. The numerical stability of such an IIRFilter is probably horrendous (in the general case).

As it currently stands, you'd have to break the AP and FBCF filters into smaller IIR filters and cascade them together. This probably also suffers from numerical instability even though the zeroes and poles of the original filters are easily expressible (assuming N is an integer).

The only other viable alternative would be to add a new node type to support these kinds of filters or to use an AudioWorkletNode to implement them.

@joeberkovitz
Copy link
Contributor

Going to have to rely on AudioWorkletNode for this, there's no will to make something built-in for thousands of coefficients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants