aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Quessy <alexandrequessy@users.sourceforge.net>2006-11-28 17:42:42 +0000
committerAlexandre Quessy <alexandrequessy@users.sourceforge.net>2006-11-28 17:42:42 +0000
commit8712a59a239c36d52156abe5c343fd187702cc36 (patch)
tree3c745e0fca3bd730917a7da842d5f1f352b71732
parent59b596f669816db70ec3d17303faf8b17b8e83fb (diff)
Adding median that supports lists.
svn path=/trunk/externals/mapping/; revision=6494
-rw-r--r--median-help.pd22
-rw-r--r--median.pd29
-rw-r--r--median_n-help.pd33
3 files changed, 66 insertions, 18 deletions
diff --git a/median-help.pd b/median-help.pd
new file mode 100644
index 0000000..136145e
--- /dev/null
+++ b/median-help.pd
@@ -0,0 +1,22 @@
+#N canvas 632 165 556 301 10;
+#X obj 16 105 cnv 15 60 60 empty empty empty 20 12 0 14 -258699 -66577
+0;
+#X floatatom 22 220 5 0 0 0 - - -;
+#X text 326 235 )c( Alexandre Quessy 2006;
+#X msg 89 55 123 234 345 123 345 67;
+#X obj 390 203 zexy;
+#X text 324 203 Requires;
+#X obj 474 203 expr;
+#X text 436 203 and;
+#X text 328 249 Release under the GPL v2;
+#X text 125 139 Calculates the median of a list of floats.;
+#X text 127 103 [median];
+#X msg 89 29 999 999 7 6 5 0 -99999;
+#X msg 88 4 0 67 68 67 69 67 1023;
+#X obj 22 115 median;
+#X text 131 250 See also;
+#X obj 199 247 median_n;
+#X connect 3 0 13 0;
+#X connect 11 0 13 0;
+#X connect 12 0 13 0;
+#X connect 13 0 1 0;
diff --git a/median.pd b/median.pd
new file mode 100644
index 0000000..26445fa
--- /dev/null
+++ b/median.pd
@@ -0,0 +1,29 @@
+#N canvas 609 51 652 617 10;
+#X obj 88 37 inlet;
+#X obj 117 321 list split 5;
+#X obj 159 490 list split 1;
+#X obj 159 550 outlet;
+#X obj 127 461 list split;
+#X obj 126 371 sort;
+#X obj 117 237 list append;
+#X obj 290 316 expr rint(($f1+1)/2)-1;
+#X text 329 585 )c( Alexandre Quessy 2006;
+#X text 214 547 median;
+#X obj 213 157 length;
+#X obj 175 93 t l l;
+#X text 86 12 inlet 1 : list of floats;
+#X obj 141 140 drip;
+#X connect 0 0 11 0;
+#X connect 1 0 5 0;
+#X connect 1 0 6 1;
+#X connect 1 2 6 1;
+#X connect 2 0 3 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X connect 6 0 1 0;
+#X connect 7 0 4 1;
+#X connect 10 0 1 1;
+#X connect 10 0 7 0;
+#X connect 11 0 13 0;
+#X connect 11 1 10 0;
+#X connect 13 0 6 0;
diff --git a/median_n-help.pd b/median_n-help.pd
index 817a8b7..aa0feb7 100644
--- a/median_n-help.pd
+++ b/median_n-help.pd
@@ -3,14 +3,11 @@
0;
#X floatatom 22 30 5 0 0 0 - - -;
#X floatatom 22 220 5 0 0 0 - - -;
-#X text 120 166 Calculates the median of the last n numbers in a stream
+#X text 112 93 Calculates the median of the last n numbers in a stream
of numbers.;
-#X text 120 221 )c( Alexandre Quessy 2006;
-#X msg 89 55 123 234 345 123 345 67;
-#X obj 56 81 drip;
-#X obj 184 197 zexy;
-#X text 118 197 Requires;
-#X text 191 118 [median <sample set size>];
+#X text 349 254 )c( Alexandre Quessy 2006;
+#X obj 414 225 zexy;
+#X text 348 225 Requires;
#N canvas 0 0 342 294 more 0;
#X obj 90 103 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144
-1 -1 0 1;
@@ -20,15 +17,15 @@ of numbers.;
#X obj 127 139 median_n 25;
#X connect 0 0 3 0;
#X connect 3 0 1 0;
-#X restore 404 261 pd more examples;
-#X msg 87 29 999 999 7 6 5 0 0;
-#X obj 268 197 expr;
-#X text 230 197 and;
-#X text 94 82 Needs a stream of floats \, not a list;
-#X text 122 243 Release under the GPL v2;
+#X restore 117 172 pd more examples;
+#X obj 498 225 expr;
+#X text 460 225 and;
+#X text 352 268 Release under the GPL v2;
#X obj 22 115 median_n 6;
-#X connect 1 0 16 0;
-#X connect 5 0 6 0;
-#X connect 6 0 16 0;
-#X connect 11 0 6 0;
-#X connect 16 0 2 0;
+#X text 108 55 [median_n <sample set size>];
+#X text 112 119 Useful for discarding irrealistic values received from
+electronic sensors.;
+#X text 119 268 See also;
+#X obj 187 266 median;
+#X connect 1 0 11 0;
+#X connect 11 0 2 0;