#N canvas 432 38 560 602 10;
#X declare -stdpath ./;
#X obj 2 575 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 3 398 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 3 493 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 3 527 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 78 502 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 110 407 signal;
#X msg 384 192 rms;
#X msg 384 150 bipolar;
#X msg 384 171 absolute;
#X obj 79 407 cnv 17 3 80 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 116 423 float;
#X text 169 407 - the signal to be averaged;
#X text 110 502 signal;
#X text 98 535 1) float;
#X text 98 553 2) symbol;
#X text 104 440 bipolar;
#X text 98 456 absolute;
#X text 128 472 rms;
#X text 169 553 - sets mode: bipolar (default) \, absolute or rms;
#X obj 216 151 hsl 150 15 1 50 1 0 adsfadsg ahhah empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 271 176 noise~;
#X text 221 150 'n' samples to average;
#X text 169 502 - the moving average over the last 'n' samples;
#X text 169 535 - maximum and initial 'n' samples (default 100 \, minimum 1);
#X text 169 440 - outputs average over positive and negative values;
#X text 169 456 - outputs average over absolute values;
#X text 169 472 - outputs 'root mean square' (RMS) values;
#X text 169 423 - 'n': number of last samples to apply the average to;
#N canvas 685 122 425 509 backwards 0;
#X obj 155 181 cyclone/rand~ 10;
#X obj 155 213 cyclone/average~ 44100;
#X obj 155 315 vsl 15 128 -1 1 0 0 gsgg fdssd empty 0 -9 0 10 #dcdcdc #000000 #000000 0 1;
#X text 140 371 0;
#X text 141 307 1;
#X text 136 436 -1;
#X obj 155 275 nbx 9 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 32 18 [average~] used to have a control number output in Max 4 \, but Max 5 updated it a signal output that provides sample accurate precision!, f 59;
#X text 32 64 Originally developed in the Max 4 era \, cyclone versions up to '0.2 beta' include this old behaviour of [average~]. Cyclone 0.3 updates all objects to Max 7 \, and [average~] is the only one that may require adapting older patches.;
#X text 32 123 For a float output now \, you have to convert the signal with objects like vanilla's [snapshot~] or [cyclone/snapshot~].;
#X obj 155 245 cyclone/snapshot~ 1;
#X connect 0 0 1 0;
#X connect 1 0 10 0;
#X connect 6 0 2 0;
#X connect 10 0 6 0;
#X restore 446 244 pd backwards \; compatibility;
#N canvas 615 44 441 576 more 0;
#X text 23 65 The first argument specifies the maximum buffer size to average the signal. You can change with a float input the number of samples to average but values gretaer than the argument are clipped to that maximum value. The minimum average value is "1" \, which makes it the original signal for the bipolar mode \, or the absolute value of the original signal (for absolute and rms mode). Values smaller than "1" are simply ignored.;
#X text 23 177 Each time [average~] receives a number value \, it clears the samples from the buffer \, even if the number is the same as the previously set number. So you may have to use the [change] object if you don't want the same number to clear the buffer., f 60;
#X text 23 16 A moving/running average outputs a mean between a given number of last samples ('n') for each sample. Only integer values make sense \, so floats are converted to integers!, f 60;
#X obj 217 331 noise~;
#X obj 217 387 cyclone/average~ 8;
#X text 26 251 In the default bipolar mode \, [average~] also acts as a regular moving average filter \, which is a kind of lowpass filter. Listen to the difference below.;
#X obj 83 443 output~;
#X obj 217 443 output~;
#X obj 158 528 declare -stdpath ./;
#X connect 3 0 4 0;
#X connect 3 0 6 0;
#X connect 4 0 7 0;
#X restore 434 223 pd more details;
#X text 391 132 modes:;
#X obj 213 176 nbx 2 15 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 12 #dcdcdc #000000 #000000 0 256;
#X obj 271 218 cyclone/average~ 50;
#X obj 500 69 cyclone/dsponoff~;
#X obj 2 3 header average~;
#X text 22 56 Signal moving average;
#X obj 290 278 metro 500;
#X obj 271 306 tabwrite~ \$0-array;
#X obj 39 230 cnv 19 198 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array \$0-array 200 float 0;
#X coords 0 -1 199 1 200 100 1;
#X restore 38 229 graph;
#X obj 290 257 loadbang;
#X text 21 222 1;
#X text 21 272 0;
#X text 15 318 -1;
#X text 182 350 Plugdata users or those with ELSE can also use [else/mov.avg~] and [mov.rms~], f 40;
#X text 50 83 Use [average~] for a signal running/moving average over the last 'n' given samples. The average is done in 3 modes: bipolar (default \, an arithmetic mean) \, absolute (arithmetic mean over absolute values) and rms(moving RMS average)., f 68;
#X text 444 300 click:;
#X obj 444 371 open-else;
#X text 22 358 see also:;
#X obj 87 347 cyclone/avg~;
#X msg 444 320 mov.avg~;
#X msg 454 344 mov.rms~;
#X obj 87 367 cyclone/mean;
#X connect 6 0 32 0;
#X connect 7 0 32 0;
#X connect 8 0 32 0;
#X connect 19 0 31 0;
#X connect 20 0 32 0;
#X connect 31 0 32 0;
#X connect 32 0 37 0;
#X connect 36 0 37 0;
#X connect 40 0 36 0;
#X connect 50 0 47 0;
#X connect 51 0 47 0;
