Hi, there's actually a nice and easy way of implementing a moving average filter of ANY length using only an integrator and a samplewise delay [z~]. The formular for a moving average filter of N points is simply: y[n] = (x[n] - x[n-N])/N + y[n-1]. I attached an abstraction. Not totally sure this is what you're looking for.
Cheers
#N canvas 431 108 1046 604 10; #X obj 58 40 inlet~; #X obj 109 134 -~; #X obj 170 5 inlet; #X obj 168 82 max 1; #X obj 113 219 outlet~; #X msg 166 123 clear; #X obj 169 55 route float bang; #X obj 298 -1 \$1; #X obj 295 -25 loadbang; #X obj 297 19 sel 0; #X msg 298 55 64; #X obj 125 101 z~; #X obj 113 188 rpole~ 1; #X obj 167 30 t f b; #X text 271 105 simple moving average filter. an optional argument and the right inlet set the number of samples to be averaged.; #X obj 63 65 /~; #X connect 0 0 15 0; #X connect 1 0 12 0; #X connect 2 0 13 0; #X connect 3 0 11 1; #X connect 3 0 12 0; #X connect 3 0 15 1; #X connect 5 0 12 0; #X connect 6 0 3 0; #X connect 6 1 5 0; #X connect 7 0 9 0; #X connect 8 0 7 0; #X connect 9 0 10 0; #X connect 9 1 3 0; #X connect 10 0 3 0; #X connect 11 0 1 1; #X connect 12 0 4 0; #X connect 13 0 6 0; #X connect 13 1 5 0; #X connect 15 0 1 0; #X connect 15 0 11 0;
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
