Forums > MaxMSP

How to measure rate of change

November 14, 2007 | 10:16 am

I was wondering if anyone had any useful ways of measuring rate of change in a variable? Are there any particular externals or abstractions that are useful for this?


November 14, 2007 | 10:36 am

> I was wondering if anyone had any useful ways of measuring rate of
> change in a variable?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 61 93 27 196617 -;
#P number 61 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 61 69 27 196617 t i i;
#P number 61 44 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 0 0 1 0;
#P connect 3 0 2 0;
#P connect 1 1 3 0;
#P connect 1 0 3 1;
#P window clipboard copycount 4;

> Are there any particular externals or abstractions that are useful
> for this?

Probably lots of them, for example jcom.delta.

Cheers,
Alexander


November 14, 2007 | 10:38 am

Is it something like this you are looking for?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 228 305 152 196617 average rate of change;
#P number 165 303 57 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 165 246 57 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 165 273 33 196617 mean;
#P toggle 165 23 15 0;
#P newex 165 47 58 196617 metro 200;
#P newex 197 113 37 196617 + 100;
#P newex 165 78 70 196617 random 1000;
#P newex 165 197 30 196617 t b b;
#P newex 165 223 35 196617 timer;
#P newex 165 170 40 196617 change;
#P window linecount 2;
#P comment 228 243 100 196617 interval between different numbers;
#P connect 8 0 10 0;
#P connect 9 0 8 0;
#P connect 3 0 2 0;
#P connect 3 1 2 1;
#P connect 1 0 3 0;
#P connect 4 0 1 0;
#P connect 4 0 5 0;
#P connect 2 0 9 0;
#P connect 7 0 6 0;
#P fasten 5 0 6 1 202 139 252 139 252 39 218 39;
#P connect 6 0 4 0;
#P window clipboard copycount 12;


November 14, 2007 | 10:42 am

I would use a combination of ‘table’ and ‘expr’, but it all depends on details.. couldn’t help you there!


November 14, 2007 | 10:59 am

Those are both good solutions depending on the specific situation (I have a lot of situations to deal with right now). This should be a good starting point for me.

What is jcom.delta? A google search did not reveal anything.


November 14, 2007 | 11:14 am

Trond Lossius has, IIRC, blessed the world with an object for this.


Owen

Solomon Bothwell wrote:
> I was wondering if anyone had any useful ways of measuring rate of
> change in a variable? Are there any particular externals or
> abstractions that are useful for this?
>
>


November 14, 2007 | 12:51 pm

i think i got this from gregory taylor
it is very useful

max v2;
#N vpatcher 79 64 1093 784;
#P origin 0 25;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 192 503 124 196620 also check out;
#P window setfont "Sans Serif" 9.;
#N prob;
#P newobj 299 530 30 196617 prob;
#P newex 263 529 32 196617 histo;
#P newex 232 528 26 196617 anal;
#P newex 191 528 33 196617 mean;
#P button 133 42 15 0;
#P window setfont "Sans Serif" 18.;
#P newex 47 111 59 196626 t b b;
#P user multiSlider 14 269 262 125 0. 1. 1 3960 61 0 0 2 0 0 1;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P user multiSlider 521 542 262 126 -0.1 0.1 1 3960 61 0 0 2 0 0 1;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#N vpatcher 220 342 820 742;
#P outlet 111 260 29 0;
#P inlet 111 81 29 0;
#P window setfont "Sans Serif" 18.;
#P newex 111 173 46 196626 !- 0.;
#P flonum 111 219 105 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 111 127 95 196626 bucket 2;
#P connect 3 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P fasten 0 1 2 1 201 162 152 162;
#P pop;
#P newobj 521 504 174 196626 p derivative;
#N vpatcher 220 342 820 742;
#P outlet 105 247 29 0;
#P inlet 105 68 29 0;
#P window setfont "Sans Serif" 18.;
#P newex 105 160 46 196626 !- 0.;
#P flonum 105 206 105 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 105 114 95 196626 bucket 2;
#P connect 3 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P fasten 0 1 2 1 195 149 146 149;
#P pop;
#P newobj 521 333 174 196626 p derivative;
#P number 222 111 67 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 96 188 75 196626 * 0.01;
#P newex 96 150 136 196626 drunk 100 10;
#P window setfont "Sans Serif" 12.;
#P comment 795 544 124 196620 acceleration;
#P comment 775 389 88 196620 velocity;
#P comment 776 238 203 196620 numbers (smoothed);
#P user multiSlider 521 370 262 126 -0.1 0.1 1 3960 61 0 0 2 0 0 1;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P window setfont "Sans Serif" 18.;
#P newex 390 351 64 196626 * 0.9;
#P newex 309 390 91 196626 + 0.;
#P newex 309 352 64 196626 * 0.1;
#P toggle 47 33 24 0;
#P newex 47 73 101 196626 metro 33;
#P newex 309 314 52 196626 f;
#P user multiSlider 521 200 262 125 0. 1. 1 3960 61 0 0 2 0 0 1;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P flonum 351 278 90 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 12.;
#P comment 694 -23 146 196620 numbers (raw);
#P connect 14 0 19 0;
#P connect 5 0 4 0;
#P connect 4 0 20 0;
#P connect 21 0 20 0;
#P connect 20 1 13 0;
#P connect 13 0 14 0;
#P connect 15 0 13 2;
#P fasten 20 0 3 0 52 252 314 252;
#P connect 3 0 6 0;
#P connect 6 0 7 0;
#P fasten 14 0 1 0 101 226 356 226;
#P connect 1 0 3 1;
#P fasten 7 0 8 0 314 444 464 444 464 339 395 339;
#P connect 8 0 7 1;
#P fasten 7 0 2 0 314 444 502 444 502 187 526 187;
#P connect 2 0 16 0;
#P connect 16 0 9 0;
#P connect 9 0 17 0;
#P connect 17 0 18 0;
#P pop;


November 14, 2007 | 1:09 pm

> What is jcom.delta? A google search did not reveal anything.

You can find it as part of Jamoma:
http://www.jamoma.org/
It is equal to tl.delta.

Alexander


November 14, 2007 | 7:19 pm

Woah this patch is perfect. Thank you everyone.


November 21, 2007 | 1:10 am

That patch is great. The smoothing idea (recursive scaling of numbers) is so simple but fundamental to data management.

Also the "instantaneous derivative" idea — I had thought you’d need to bust out the calculus book for formula-based derivatives, and sometimes you could (to get the actual full formula like for polynomials), but this version works on a point-by-point basis over change through a simple subtraction (delta). Also very fundamental and helpful to my understanding of the math involved, thanks!

–CJ


Viewing 10 posts - 1 through 10 (of 10 total)