Forums > MaxMSP

LowPass filter that doesn't LowPass filter

January 22, 2010 | 4:23 pm

…like a LowPass filter should; my basic understanding of a LowPass filter is you add half current input to half previous input, right?

Okay, so why doesn’t this example work? Imagine the slider is erratic or unpredictable user-input; raw and filtered output is identical.

– Pasted Max Patch, click to expand. –

(guess i’m still a noob then….boohoo)


January 22, 2010 | 5:40 pm

Ok – that is *A* lowpass filter – there are others.

You’re inputing what is probably a DC signal (to all intents and purposes (sig~ can’t change more than once per vector). When you average (mean average) any two consecutive samples that are the same you will get the same output value.

If you put audio through it you’ll hear the difference. You have a fixed cutoff / fixed rolloff filter there that will be audible – problem here is your input is under the cutoff freq – so it gets passed through…

If you want to filter control speed data in signal domain – check out slide~. Your patch works it just might not be the right tool for the job. That said – check carefully the arguments to delay~ – to instantiate the object properly you should use delay~ 1 1.

Alex


January 22, 2010 | 7:17 pm

Thanks for this, just a few points:

do you mean my control data (represented by the slider) frequency is too slow; DC = amplitude of 0? Which is why a delay of one sample is pointless? I probably should explore the DSP audio basics a bit more, but numbers ain’t my bag sadly.

I’m not building an audio filter, more of a control interface for people with muscle tremor etc, hence the data filtering requirement. [slide~] works very well at smoothing but still attains max and min values; what i need is a filter to ignore short term (<100ms) control gestures, and i felt that [line~] was a cop-out:

----------begin_max5_patcher----------
940.3oc2XsriaBCEccFo9OfPcYZjswFC8anK59pQUDvCCs.NBHcdoNe6EtDR
bxj.lDHD0r.icrMm6w2W991mtal4R4yhbSiuZ7CiYydqbjYvXUiLqYfYlIdO
6G6kCSzzWljHRKLmu4OKDOW.+gHKyqHx2Xo3Qu+DIWmscJoqSjqKhEEvNfZF
9AYZQpWh.V828hKWcpz3akOJdYkvTcZ4QuBSCSVrc4QAvBkK+0Wrr1N6UdE9
OFkF9yLgeQsjgs3kqx.yfmHTUCwZAx3dE.Fk1fOLL3e+zcUskMy0lZREOUhl
OxLQJz09bAtmbQ8Rgg.QC15cxgNTEoUpx0EHIWmpFKxBVqTE4ropBYXXrnKV
oCwUUrPsJVH5NM.Bu44vq.rNYoH68SHVjK8vNOJL0K1btg4CwRuddvSb2twk
6CXHtadsvYNf8BytCqlsBWhLPbY5FIh7buPwGsiHNikYTOoRm1c2T6ngTsXC
aNXCgGAanS4tINJUbEzAW5kF1SdiqkQJnvY0oB2fyaYdoAxjpHD2LdqILMXL
NnuwoWcBKQTjIGS95LTwnZPXTHHms0nQXmzC1mwFDF5FwKVqIMQs.yPpkacC
vU3qIWciPS1sxRTv1ygpjtz0zU+uEubBVhND9plerldwdz10wfTwnfqdlaGI
ahNa1K2WtRIh3x0OrC0nttjRnuLVlUCXzBJgSY34ku4ZS4H6p23TWDoLvkJx
88h88kqSKN3qrb+siXW9iO+nus29olp6VAoLfUnnYqf61r2ZNFiWaM6VGqvA
xPAycFAMVwqAd9u20U.UDKb61Y35bppUXXMOGbXmGGEHx588RTLJ1pZUcXbD
4jow8uH0oPtIoaDaDtpx+W1D7KwlXSjNW9naTbxZm7PTbgHSDb8JYBt03ZLF
vBTJTG.JezJYxIYjLumthjQ6Fk1XExvhd0qezM6E5vZkBoMDYeBtP2MKu4pQ
L.JicVzV8z.Y+vJ6Berp+3.xLWtNyuQtZJRngxGLPjWxJkLiLUYVr8mziQAA
hz8rPShBVIKyYbCPLt+zGwCL1pJQiAtOfifbpS.cS8goK3erKFWGcvEtODza
PDpphyoB2iKTGJ5cKTUESAtSBQoVd62C63TmkAH9Pug4bBo04DcRThppDkFf
ycZ.miVfi2WM7gAbLsM+P2pfiOMfipE3lFupUECpavgslDvo2o5zfMrVDG+1
k2lFebt5.sdehtIHFs7NbUQqYJ8FDTqkEr8jPn1ZY+dwPqZfxl+AbVQH8.
-----------end_max5_patcher-----------

and was hoping to build an averaging filter; but working around DC signals and signal vector size is perhaps trying to crack an egg with a bulldozer, for me anyway
Thanks again Alex


January 23, 2010 | 1:06 am

Yes – your data is too slow

"DC = amplitude of 0?"

No – DC = freq of 0Hz – i.e. static, which your signal is over short time periods – you need to build a filter with a cutoff of a few Hz for data that slow….

"[slide~] works very well at smoothing but still attains max and min values" – not sure what you mean – it’s a smoothing filter of sorts – it will not necessarily hit the max and min values that come in – it sort of depends how you set the parameters too (check out the following for instance).

There was a good thread on this a while back with a comparison patch (possibly ej or Chris Muir??) of different smoothing techniques – I think in max rather than msp, but the principles are pretty similar, and I’m not sure whether you need to do your smoothing in the audio domain anyway…

A.

– Pasted Max Patch, click to expand. –

January 23, 2010 | 1:46 am

Over very small time frames, my signal is doing nothing, hence DC. OK, I’ve got that now thanks; there’s not much to choose between [slide~] and [line~] really is there? and both have variable parameters; very clear in your last example..

End of.
Cheers


Viewing 5 posts - 1 through 5 (of 5 total)