A short while ago for a Pure Data project I thought I needed a "counting
averager" function, which calculates the average of a variable number of
values. It is probably what wikipedia calls a "cumulative moving average".

Eventually after many attempts, I succeeded implementing it in a patch.
But I realised a pd patch is not optimal for this type of calculation,
and now knowing how it works, I reimplemented it as a Tcl script.

And indeed the tcl script looks less complicated than the patch. It is
probable more accurate than the patch, but also considerable slower.

Tcl is a good match for list and text type operations where Pd gets
clunky. It can fill the gap between patch and c-external.

The zip includes the tcl script, the patch and a help file which is more
a simple test patch. It requires tclpd.tcl which is included in
pd-extended 0.44.

Enjoy,

Fred Jan

http://www.pdpatchrepo.info/hurleur/countingAverager.zip