Statistical Math Question

Mar 17, 2006 at 12:08am

Statistical Math Question

Hi,
I am using the last outlet of fiddle~ to get out freq/amp pairs of
individual sinusoidal components in this case of saxophone
multiphonics. I would like to get an ‘average frequency and amplitude’
for each component over an adjustable period of time say 15 seconds or
2 minutes. However, my rudimentary math skills are leaving me quite
baffled. I know it’s not as simple as sticking a mean object on each
component as high-frequency jumps skew the results and I am looking for
some waiting of each frequency reported based on its amplitude.
Basically, if I were to play a single multiphonic for 20 seconds, I
would like to know what were the, say 7, strongest frequency areas and
their relative amplitudes. Like an averaged sonogram but in numbers.

Thanks in advance,
Justin Yang

#24925
Mar 17, 2006 at 12:19am

Here’s part of the patch.

max v2;
#N vpatcher 11 44 1339 895;
#P origin 0 26;
#P window setfont “Sans Serif” 9.;
#P flonum 1152 286 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1006 286 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 865 286 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 721 286 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 575 286 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 434 286 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 1152 257 53 196617 r P6-amp;
#P newex 1006 257 53 196617 r P5-amp;
#P newex 865 257 53 196617 r P4-amp;
#P newex 721 257 53 196617 r P3-amp;
#P newex 575 257 53 196617 r P2-amp;
#P newex 434 257 53 196617 r P1-amp;
#P number 141 264 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 264 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 1096 257 54 196617 r P6-freq;
#P flonum 1096 285 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 950 257 54 196617 r P5-freq;
#P flonum 950 285 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 809 257 54 196617 r P4-freq;
#P flonum 809 285 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 665 257 54 196617 r P3-freq;
#P flonum 665 285 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 249 707 53 196617 s P8-amp;
#P newex 249 652 53 196617 s P7-amp;
#P newex 96 707 54 196617 s P8-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 2 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 5 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 688 35 196617 p lbyl;
#P number 141 673 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 673 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 96 652 54 196617 s P7-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 5 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 2 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 632 35 196617 p lbyl;
#P number 141 617 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 617 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 690 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 690 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 634 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 634 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 167 671 92 196617 unpack 0. 0.;
#P newex 167 615 92 196617 unpack 0. 0.;
#P newex 249 597 53 196617 s P6-amp;
#P newex 249 542 53 196617 s P5-amp;
#P newex 96 597 54 196617 s P6-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 5 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 2 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 578 35 196617 p lbyl;
#P number 141 563 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 563 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 96 542 54 196617 s P5-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 2 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 5 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 522 35 196617 p lbyl;
#P number 141 507 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 507 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 580 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 580 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 524 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 524 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 167 561 92 196617 unpack 0. 0.;
#P newex 167 505 92 196617 unpack 0. 0.;
#P newex 249 485 53 196617 s P4-amp;
#P newex 249 430 53 196617 s P3-amp;
#P newex 96 485 54 196617 s P4-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 5 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 2 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 466 35 196617 p lbyl;
#P number 141 451 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 451 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 96 430 54 196617 s P3-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 2 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 5 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 410 35 196617 p lbyl;
#P number 141 395 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 395 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 468 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 468 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 412 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 412 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 167 449 92 196617 unpack 0. 0.;
#P newex 167 393 92 196617 unpack 0. 0.;
#P newex 249 375 53 196617 s P2-amp;
#P newex 249 320 53 196617 s P1-amp;
#P newex 519 257 54 196617 r P2-freq;
#P flonum 519 285 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 96 375 54 196617 s P2-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 2 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 5 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 356 35 196617 p lbyl;
#P number 141 341 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 341 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 96 320 54 196617 s P1-freq;
#N vpatcher 10 59 321 354;
#N comlet data out;
#P outlet 112 204 15 0;
#N comlet data in;
#P inlet 68 117 15 0;
#N comlet tolerance;
#P inlet 112 117 15 0;
#N comlet quota;
#P inlet 186 117 15 0;
#P window setfont “Sans Serif” 9.;
#P message 112 145 67 196617 tolerance $1;
#P message 186 145 49 196617 quota $1;
#P newex 112 172 54 196617 lbyl 10. 6;
#P connect 4 0 2 0;
#P connect 5 0 0 0;
#P fasten 1 0 0 0 191 166 117 166;
#P connect 2 0 0 0;
#P connect 0 0 6 0;
#P connect 3 0 1 0;
#P pop;
#P newobj 96 300 35 196617 p lbyl;
#P number 141 285 20 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 107 285 35 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 378 257 54 196617 r P1-freq;
#P flonum 249 358 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 358 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 249 302 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 167 302 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 167 339 92 196617 unpack 0. 0.;
#P newex 167 283 92 196617 unpack 0. 0.;
#P hidden newex 167 257 183 196617 route 1 2 3 4 5 6 7 8 9 10 11 12 13;
#P newex 71 225 107 196617 fiddle~ 2048 1 20 13;
#P flonum 378 285 41 9 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 3 0 12 0;
#P connect 12 0 13 0;
#P connect 4 0 16 0;
#P connect 16 0 17 0;
#P connect 22 0 30 0;
#P connect 30 0 31 0;
#P connect 23 0 34 0;
#P connect 34 0 35 0;
#P connect 38 0 46 0;
#P connect 46 0 47 0;
#P connect 39 0 50 0;
#P connect 50 0 51 0;
#P connect 54 0 62 0;
#P connect 62 0 63 0;
#P connect 55 0 66 0;
#P connect 66 0 67 0;
#P hidden connect 78 0 10 0;
#P hidden connect 78 0 14 0;
#P hidden connect 78 0 28 0;
#P hidden connect 78 0 32 0;
#P hidden connect 78 0 44 0;
#P hidden connect 78 0 48 0;
#P hidden connect 78 0 60 0;
#P hidden connect 78 0 64 0;
#P connect 10 0 12 1;
#P connect 14 0 16 1;
#P connect 28 0 30 1;
#P connect 32 0 34 1;
#P connect 44 0 46 1;
#P connect 48 0 50 1;
#P connect 60 0 62 1;
#P connect 64 0 66 1;
#P connect 11 0 12 2;
#P connect 15 0 16 2;
#P connect 29 0 30 2;
#P connect 33 0 34 2;
#P connect 45 0 46 2;
#P connect 49 0 50 2;
#P connect 61 0 62 2;
#P connect 65 0 66 2;
#P hidden connect 79 0 11 0;
#P hidden connect 79 0 15 0;
#P hidden connect 79 0 29 0;
#P hidden connect 79 0 33 0;
#P hidden connect 79 0 45 0;
#P hidden connect 79 0 49 0;
#P hidden connect 79 0 61 0;
#P hidden connect 79 0 65 0;
#P hidden connect 1 4 2 0;
#P hidden connect 2 0 3 0;
#P connect 3 0 5 0;
#P connect 2 1 4 0;
#P connect 4 0 7 0;
#P hidden connect 2 2 22 0;
#P connect 22 0 24 0;
#P hidden connect 2 3 23 0;
#P connect 23 0 26 0;
#P hidden connect 2 4 38 0;
#P connect 38 0 40 0;
#P hidden connect 2 5 39 0;
#P connect 39 0 42 0;
#P hidden connect 2 6 54 0;
#P connect 54 0 56 0;
#P hidden connect 2 7 55 0;
#P connect 55 0 58 0;
#P connect 3 1 6 0;
#P connect 6 0 20 0;
#P connect 4 1 8 0;
#P connect 8 0 21 0;
#P connect 22 1 25 0;
#P connect 25 0 36 0;
#P connect 23 1 27 0;
#P connect 27 0 37 0;
#P connect 38 1 41 0;
#P connect 41 0 52 0;
#P connect 39 1 43 0;
#P connect 43 0 53 0;
#P connect 54 1 57 0;
#P connect 57 0 68 0;
#P connect 55 1 59 0;
#P connect 59 0 69 0;
#P connect 9 0 0 0;
#P connect 80 0 86 0;
#P connect 19 0 18 0;
#P connect 81 0 87 0;
#P connect 71 0 70 0;
#P connect 82 0 88 0;
#P connect 73 0 72 0;
#P connect 83 0 89 0;
#P connect 75 0 74 0;
#P connect 84 0 90 0;
#P connect 77 0 76 0;
#P connect 85 0 91 0;
#P pop;

#72765
Mar 17, 2006 at 1:06am

I’m not quite sure this answers your problem but one statistical formula
you might find useful is the running average. Now, I’m not sure exactly
what you mean by high frequency jumps skewing results and weighting
based on amplitude so the formula below doesn’t address that.

Running average = x * alpha + ((1 – alpha) * previous running average)

As you can see, it’s a form of simple feedback algorithm where you plug
the result of the equation back in. Alpha is a value between 0 and 1.
Lower values mean longer averaging times. If alpha = 1, no averaging is
done. This is also useful for smoothing data — i.e. getting rid of
spikes. See patch below.

Jean-Marc

#72766
Mar 17, 2006 at 1:20am

Btw, the slide object in MaxMSP 4.5 does this with user settable
constants for positive and negative deltas (rise and fall).

-Joshua

#72767
Mar 17, 2006 at 2:54am

this should be simple.

i usualy make fiddle~s output a signal first.
to flatten the intonation line you can now use
lowpassfilters, or slide~, or rampsmooth~.
to control what happens just connect a cycle~
and listen to it.

#72768
Mar 17, 2006 at 10:04am

On 17-Mar-2006, at 2:06, Jean-Marc Pelletier wrote:
> Running average = x * alpha + ((1 – alpha) * previous running average)

lp.stacey does this automatically. Give her an initialization
argument specifying how wide your window is (10 data points, 20 data
points, whatever) and she’ll do the math. Follow the URI below to the
Litter Starter Pack for more information.

I’d give you an example but I don’t have fiddle~ installed on this
machine yet.

– Peter

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine | +–> Litter Power & Litter Bundle for Jitter
|…………………………………………….
p@castine.de | iCE: Sequencing, Recording, and Interface Building
pcastine@gmx.net | for Max/MSP
pcastine@bek.no | http://www.dspaudio.com/ Extremely cool
4-15@kagi.com |…………………………………………….
| home|chez nous|wir|i nostri http://www.castine.de/

#72769

You must be logged in to reply to this topic.