Forums > MaxMSP

Median for Stream of Lists

May 5, 2011 | 4:46 pm

Hi all,
I’d like to calculate the median of a stream of lists.
by that I mean:
I have a continuous flow of lists (of say length 5) coming in.
Now I’d like to calculate the median for each position (compared to the previous lists at the same position).
So I don’t want to calculate the median for one single list but basically as many medians as my lists are long.

E.g.
a median window size of 3 and a list length of 3:

List 1: 1 2 1
List 2: 1 2 2
List 3: 0 2 3

Should output:
Result: 1 2 2

I hope I made this clear.

This actually seems like a very basic thing but I just can’t find an external or abstraction for this.

Does anybody know of one?

All the best

Frank


May 6, 2011 | 9:49 am

Hi all,
ok I had a go at it using scripting,
I’m pretty sure that’s not the fastest way to do it though.

this is the abstraction:
save as: "median-list-scripting"

– Pasted Max Patch, click to expand. –

this is the "help-file":

– Pasted Max Patch, click to expand. –

Any modifications or faster alternatives are welcome!

Best Frank


May 6, 2011 | 10:55 am

quick and easy with bach – http://www.bachproject.net ;)

– Pasted Max Patch, click to expand. –

aa


Viewing 3 posts - 1 through 3 (of 3 total)