runningmean-help.pd 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #N canvas 216 528 808 369 10;
  2. #X obj 191 231 runningmean 128;
  3. #X msg 121 144 clear;
  4. #X msg 165 189 length 10;
  5. #X msg 278 209 22;
  6. #X floatatom 191 262 5 0 0 0 - - -;
  7. #X obj 11 36 bng 15 250 50 0 empty empty empty 17 7 0 10 -257985 -1
  8. -1;
  9. #X text 29 35 bang outputs current mean;
  10. #X msg 76 99 1;
  11. #X msg 98 121 2;
  12. #X text 155 261 mean:;
  13. #X text 63 69 Incoming floats are added to the array. The mean is recalculated
  14. for each incoming float;
  15. #X text 287 231 Argument sets initial length. Default (no argument)
  16. is 128;
  17. #X text 10 4 [runningmean] outputs the running mean of the last n floats
  18. to arrive on the left inlet.;
  19. #X text 249 251 Length can be changed to any positive value less than
  20. or equal to the length set by the creation argumwent;
  21. #X text 505 289 Martin Peach 2009/04/10;
  22. #N canvas 701 617 494 344 META 0;
  23. #X text 12 155 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan
  24. Wilkes for Pd version 0.42.;
  25. #X text 12 25 LICENSE GPL v2 or later;
  26. #X text 12 135 AUTHOR Martin Peach;
  27. #X text 12 5 KEYWORDS control analysis;
  28. #X text 12 46 DESCRIPTION output the running mean of the last n floats
  29. to arrive on the left inlet;
  30. #X text 12 75 INLET_0 float bang clear length;
  31. #X text 12 95 INLET_1 float;
  32. #X text 12 115 OUTLET_0 float;
  33. #X restore 621 319 pd META;
  34. #X msg 145 168 clear 10;
  35. #X text 231 189 set length (and sets the new array to the current mean)
  36. ;
  37. #X text 304 208 another way to set length;
  38. #X text 203 167 set the array to all 10s;
  39. #X text 159 144 clear the array to all zeroes;
  40. #X connect 0 0 4 0;
  41. #X connect 1 0 0 0;
  42. #X connect 2 0 0 0;
  43. #X connect 3 0 0 1;
  44. #X connect 5 0 0 0;
  45. #X connect 7 0 0 0;
  46. #X connect 8 0 0 0;
  47. #X connect 16 0 0 0;