LowPass filter that doesn't LowPass filter

brendan mccloskey's icon

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

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

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

(guess i'm still a noob then....boohoo)

AlexHarker's icon

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

brendan mccloskey's icon

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.

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

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 (

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

AlexHarker's icon

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...

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

A.

brendan mccloskey's icon

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