One "sample" delay for MAX

Luca's icon

Hello everybody,
I want to create a simple mean filter y(n) = [x(n) + x(n-1)]/2 and I need the x(n-1) term. Actually I need to do this with max (with Msp there is the delay~ object).
What do you suggest me in order to delay the previous number in an incoming streams of numbers?

Help!

Thanks in advance

Cheers

Luca

Maurizio Giri's icon
Max Patch
Copy patch and select New From Clipboard in Max.

bucket is your friend. :)

Luca's icon

...???
Sorry but I do not understand...could you please explain me better what did you mean?

Thanks a lot

Cheers

Luca

yns's icon

I would suggest [comb~] but the [bucket] way might be interesting too.

Maurizio Giri's icon

Luca, just send your stream of Max numbers to bucket, and you will get a stream of numbers delayed by one element. Then send both streams (the original stream and the delayed one) to an expr object wich contains the filter formula. The patch I've attached in my previous post show the procedure. Copy the code from the line that contains

----------begin_max5_patcher----------

to the one containing

-----------end_max5_patcher-----------

and paste it to a Max 5 patcher window.

m

Luca's icon

Thanks a lot!!!!

Cheers

Luca

yns's icon

That won't work for audio. Max cannot handle numbers as fast as samplerate.

mzed's icon

maybe delay~?