biquad fast moving, unwanted artefacts

newtfish's icon

Hi,

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

has anyone noticed unwanted spikes/artefacts in the biquad filter? Im running an lfo through it and every 3 iterations or so it spikes, creating a distorted signal. Id be really grateful to find out any strategies for smoothing out biquad (other than smooth-biquad~ which doesnt currently work as x64).

Is the filter blown as suggested in this article? https://cycling74.com/tutorials/max-5-guitar-processor-part-2/ Do I need to clear it after every iteration to get it to be smooth?

Cheers

newtfish's icon

Heres a patch to explain what the problem is. Just turn on the audio at the bottom and turn up the Hz box at the top. For some reason, filtergraph is jumping about all over the place, creating unwanted/uneven/spikes in the frequencies.

Could this be because I am using the exponent inlet of scale? Would be grateful if someone could take a look and offer any advice as to why biquad might not be smooth at faster frequencies.

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

Heres another example, if you turn the knob half way up, every 1 second or so you can hear the spike

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

Heres another example using filtercoeff~ which makes the problem even worse: (you might have to tweak the numbox connected to scale to 1700)

Peter McCulloch's icon

(Not at computer to check so...)

Are you interpolating at signal rate? (e.g. curve~ or line~ instead of line)

You want to use filtercoeff~. It only calculates the coefficients once per signal vector by default IIRC, but you can upsample it to improve this resolution (check the reference).

For super fast sweeps, other filters work better, such as svf~, lores~, etc. (PM.Ladder~, too)

Peter McCulloch's icon

Yeah, avoid snapshot~ in situations like this. You're downsampling the signal, and that's causing less frequent updates, hence discontinuities.

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

Example attached.

newtfish's icon

Hi Peter,

Thanks.

Ive tried changing my patch to use signal only with the scale~ object but I cant get it sound the same no matter how much I change the exponential (it just doesnt sound anything like with the data scale object, it misses all the lowend and only catches the top end of the filter) Ive moved to another filter now and using snapshot it seems to sound just fine. Is there any chance you can confirm that I should "always" use signal on filters? even if it already sounds fine using data input?

Peter McCulloch's icon

Yes. Always use signal on filters if you need to sweep it fast.

The problem with your exponent appears to be that you're using a gigantic value. Under normal (@classic 1, the default for scale) operation, you'd expect to be using values between 1 and maybe 1.5. (it's been a while, I really dislike classic-mode and always use it with @classic 0, since you can specify an exponent in an obvious way.)

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

What works a lot better is just to specify your cutoff in MIDI pitch. It'll go evenly across the octaves and you can tweak the exponents easily. Here's an example: (works fine for fast LFO rates)