Help with an exercise about filters

sno's icon

Hello.

I'm trying to create a filter kind of like a biquad for an exercise, using this formula - y[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2] - b1 * y[n-1] - b2 * y[n-2] with delays anda tape in and out, but i'm doing something wrong because it is not working. Can anyone help or point me in the right direction?

Thank you!

Max Patch
Copy patch and select New From Clipboard in Max.

1880.Picture1.png
png
brendan mccloskey's icon

I didn't look at your patch, but there's a detailed description of how to build a biquad in Max here (at 1:25), in my reply to this post

Brendan

sno's icon

Thank you so much!

rolnxyz's icon

@n00b_meister

I followed the YouTube tutorial, thanks a lot. That was very helpful.

I am having problems making your biquad work, I have tried many different things. I made a patch that uses your biquad patch and compares it to max msp's biquad.

What am I doing wrong? Why do the spectrogram results look completely different?

Thanks

1921.biquadIssue.png
png
brendan mccloskey's icon

Hi

the tutorial I posted was a theoretical explanation; how the Max biquad implements delaytimes in the filter equation is something I don't know. However, we do know that in practical terms the tapin~/out~ minimum delay time is restricted to the signal vector size as set in the DSP preferences. I demonstrated a theoretical delaytime of 1 sample (a delay of c. 0.022ms) an unfeasibly small amount. 8 samples gives c 0.18ms and 512 samples gives c 11.61ms. That's as far as my maths goes I'm afraid. Clearly, different delay values fed into any filter equation will generate different results; I hope this helps

Brendan

rolnxyz's icon

Thanks,

I recreated the biquad again, and used a vector size of 1 in the DSP options. It improved, but it's still very inconsistent. I posted the patch.

Is there any way I can do this in max/msp without having to program the biquad in an external?

Max Patch
Copy patch and select New From Clipboard in Max.

I am really looking forward for a real time solution to design filters like this. If max/msp isn't the best option, do you know of other tools I can use?

Jean-Francois Charles's icon

[mxj~] might be your best option in Max. Although java is not very fashionable these days.
If you want to stay in MSP, and if you succeed with your idea, you could then embed the "sample-precision" DSP in a [poly~], to be able to work with other vector sizes in the main patch.
By the way, did you try to use the sample accurate [delay~] instead of tapin~/tapout~?
If you want to try out other tools, NI Reaktor's Core layer is designed to do what you're looking for.
Jean-Francois.

rolnxyz's icon

I just tried to use delay~ with a delay size of 1 sample. The problem of using delay~ is that the IIR part of the filter creates a feedback loop and msp disables audio as soon as that happens. This is pointed out in delay~ help page.

https://cycling74.com/forums/feedback-in-a-patch in here they say the only way to get feedback with delay~ is to use send and receive or tapin~ tapout~.

The next thing I will try is your poly~ suggestion

I have Reaktor, thanks for that, I will try a little harder before I use Core layer.