hello,
i did not try it yet, but it look good. since it's pure pd, unlike the median_n from the mapping stuff, do you mind if i use your version for the mapping lib?
Cyrille
Damian Stewart a écrit :
hey list,
here's [d-median], a 'running median' abstraction i put together today. it's pure-Pd, for your PDa/Palmpilot/iPhoning pleasure. it outlets a running median of the last n values sent to its inlet.
internally, it maintains two arrays - one a sorted list of values, the other a table of the timetags associated with each value. when you pass it a new value it increments the current timetag, finds the 'oldest' value in the list (the value with the current timetag) and removes it, and inserts the new value in-order, attaching the current timetag. this is implemented as a single pass through the array, doing the smallest number of copies possible, so it's fairly efficient.
also included is [d-for], a C-like for loop based on [until]. you can say [d-for 0 20], bang it, and it will outlet sequentially 0,1,2,...,19. you can also say [d-for 0 20 2] to increment by 2 instead of 1, or even [d-for 0 1 0.1427] (negative increments are not supported unfortunately). and just like in C, if you say [d-for 1 0], nothing at all will be output. there's a debug mode as well, which allows you to step one iteration at a time - great for debugging code that is based around the [d-for]. have a look at the help for examples.
working on additional documentation for the dlib - everything in here is documented... comments appreciated.
d
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list