view examples/MSP/test/xtract-test.pat @ 214:f28f66faa016

Add "stateful" feature type with initial feature "last n" Stateful feature extraction functions are functions that require state to be maintained between successive calls. This is necessary, for example when an accumulation of values is required, or changes need to be measured over time. The initial xtract_last_n() function accumulates the last N (single) values from *data and writes them to *result
author Jamie Bullock <jamie@jamiebullock.com>
date Tue, 03 Jun 2014 21:17:07 +0100
parents 25fc4d0767f9
children
line wrap: on
line source
max v2;
#N vpatcher 22 65 823 798;
#P origin -203 -11;
#P window setfont "Sans Serif" 9.;
#P newex 154 177 46 196617 / 1000.;
#P newex 19 349 39 196617 noise~;
#P flonum 79 206 88 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 79 180 71 196617 expr log($f1);
#P message 377 385 68 196617 /braun/5 \$1;
#P message 305 385 68 196617 /braun/4 \$1;
#P message 229 385 68 196617 /braun/3 \$1;
#P message 155 386 68 196617 /braun/2 \$1;
#P flonum 657 181 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 511 176 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 426 179 66 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 334 180 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 594 180 55 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 0 378 69 196617 send~ source;
#P newex 425 150 72 196617 r irregularity;
#P newex 508 151 72 196617 r fundamental;
#P newex 656 151 57 196617 r variance;
#P newex 223 151 104 196617 r standard_deviation;
#P newex 593 150 55 196617 r centroid;
#P newex 79 148 55 196617 r kurtosis;
#P newex 332 151 80 196617 r inharmonicity;
#P newex 154 151 61 196617 r skewness;
#N vpatcher 9 59 787 818;
#P window setfont "Sans Serif" 9.;
#P newex 622 460 37 196617 pack f;
#P window linecount 1;
#P newex 213 260 83 196617 receive~ source;
#P newex 213 290 35 196617 *~ 1.;
#P newex 516 261 72 196617 s irregularity;
#P newex 226 390 72 196617 s fundamental;
#P newex 557 514 57 196617 s variance;
#P newex 364 560 104 196617 s standard_deviation;
#P newex 312 444 55 196617 s centroid;
#P newex 183 688 55 196617 s kurtosis;
#P newex 70 468 80 196617 s inharmonicity;
#P newex 7 689 61 196617 s skewness;
#P newex 71 423 95 196617 receive~ spectrum;
#P message 213 426 40 196617 list \$1;
#P newex 70 445 153 196617 xtract~ spectral_inharmonicity;
#P newex 529 403 62 196617 poke~ mags;
#P newex 436 265 27 196617 / 2.;
#P newex 470 207 29 196617 * 2.;
#P newex 555 378 85 196617 count~ 0 1024 1;
#P newex 470 232 111 196617 poly~ magspec vs 512;
#P newex 7 667 134 196617 xtract~ spectral_skewness;
#P newex 7 644 95 196617 receive~ spectrum;
#P newex 408 337 44 196617 pack f f;
#P newex 183 667 128 196617 xtract~ spectral_kurtosis;
#P newex 183 644 95 196617 receive~ spectrum;
#P newex 301 559 44 196617 pack f f;
#P newex 333 513 95 196617 receive~ spectrum;
#P message 502 514 40 196617 list \$1;
#P newex 335 533 177 196617 xtract~ spectral_standard_deviation;
#P newex 502 467 95 196617 receive~ spectrum;
#P newex 442 403 81 196617 send~ spectrum;
#P newex 502 488 130 196617 xtract~ spectral_variance;
#P newex 213 360 58 196617 xtract~ f0;
#P newex 394 234 47 196617 * 1000.;
#P newex 394 212 31 196617 !/ 0.;
#P newex 324 80 27 196617 i 10;
#P newex 304 57 30 196617 t b b;
#P newex 304 35 48 196617 loadbang;
#P newex 318 169 27 196617 / 0.;
#P newex 301 326 27 196617 *~;
#P newex 318 274 46 196617 phasor~;
#P newex 318 298 87 196617 wave~ hann 0. 0.;
#P newex 304 130 54 196617 dspstate~;
#P newex 324 103 73 196617 adstatus sigvs;
#B color 5;
#P newex 301 405 128 196617 xtract~ spectral_centroid;
#P newex 301 360 117 196617 xtract~ spectrum 1024;
#P comment 406 300 109 196617 //windowing function;
#P window linecount 0;
#P comment 46 52 100 196617 //basic feature cascade;
#P comment 596 233 100 196617 //poly~ used to reduce down to half-block size to get just magnitudes;
#P comment 598 406 140 196617 //mags is inside the poly~;
#P connect 28 0 29 0;
#P connect 29 0 38 0;
#P connect 37 0 35 0;
#P connect 35 0 39 0;
#P connect 24 0 29 1;
#P connect 25 0 26 0;
#P connect 26 0 40 0;
#P connect 47 0 46 0;
#P connect 46 0 17 0;
#P connect 17 0 36 0;
#P connect 36 0 35 1;
#P connect 17 0 44 0;
#P connect 46 0 10 0;
#P connect 10 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 24 0;
#P connect 24 0 26 1;
#P connect 12 0 13 0;
#P connect 13 0 7 0;
#P connect 5 0 41 0;
#P connect 7 1 11 0;
#P connect 11 0 9 0;
#P connect 9 0 8 0;
#P connect 8 0 10 1;
#P connect 13 1 14 0;
#P connect 14 0 6 0;
#P connect 7 3 11 1;
#P connect 23 0 21 0;
#P connect 21 0 24 1;
#P connect 21 0 42 0;
#P connect 7 1 15 0;
#P connect 15 0 16 0;
#P connect 16 0 8 2;
#P connect 11 0 27 0;
#P connect 27 0 4 1;
#P connect 7 3 15 1;
#P connect 16 0 33 0;
#P connect 4 0 19 0;
#P connect 11 0 32 0;
#P connect 32 0 30 0;
#P connect 20 0 18 0;
#P connect 18 0 22 0;
#P connect 22 0 21 1;
#P connect 30 0 45 0;
#P connect 4 0 34 0;
#P connect 31 0 34 1;
#P connect 18 0 43 0;
#P connect 33 0 30 1;
#P connect 5 0 48 0;
#P connect 48 0 18 1;
#P pop;
#P newobj 594 83 37 196617 p guts;
#P newex 0 269 38 196617 * 100;
#P slider 0 116 15 128 0 1;
#P number 0 294 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 79 386 68 196617 /braun/1 \$1;
#P newex 79 476 120 196617 udpsend 127.0.0.1 4444;
#N vpatcher 10 59 364 406;
#P window setfont "Sans Serif" 9.;
#P newex 47 33 48 196617 loadbang;
#P window linecount 1;
#P newex 87 102 27 196617 t i i;
#P newex 87 258 43 196617 pack i f;
#P newex 87 80 27 196617 - 1;
#P newex 47 59 51 196617 Uzi 1024;
#P newex 87 283 59 196617 peek~ hann;
#P newex 120 227 38 196617 + 0.5;
#P newex 120 206 42 196617 * -0.5;
#P newex 104 126 46 196617 / 1023.;
#P newex 120 161 47 196617 * 6.283;
#P newex 120 183 23 196617 cos;
#P window linecount 0;
#P comment 182 38 100 196617 //makes a hanning window in a buffer called hann;
#P connect 11 0 7 0;
#P connect 7 2 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 6 0;
#P connect 10 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 9 1;
#P pop;
#P newobj 550 35 80 196617 p make_hanning;
#P newex 533 57 97 196617 buffer~ hann 23.22;
#P user ezdac~ 648 37 692 70 0;
#P newex 0 321 55 196617 saw~ 440;
#P connect 7 0 8 0;
#P connect 8 0 6 0;
#P connect 6 0 0 0;
#P connect 0 0 18 0;
#P connect 30 0 18 0;
#P connect 12 0 28 0;
#P connect 28 0 29 0;
#P connect 28 0 5 0;
#P connect 27 0 4 0;
#P connect 26 0 4 0;
#P connect 25 0 4 0;
#P connect 24 0 4 0;
#P connect 5 0 4 0;
#P connect 10 0 31 0;
#P connect 11 0 24 0;
#P connect 17 0 25 0;
#P connect 16 0 26 0;
#P connect 11 0 20 0;
#P connect 13 0 27 0;
#P connect 17 0 21 0;
#P connect 16 0 22 0;
#P connect 13 0 19 0;
#P connect 15 0 23 0;
#P pop;