smoothing changing values – inertia – slide – acceleration

Jun 30, 2007 at 12:49am

smoothing changing values – inertia – slide – acceleration

Hi all,

I still haven’t found a solution to tis:
I have randomly incoming values like for example these:

165.0
221.1
0.5
-123

the time between the values is unknown.
As soon as the value changes I want to blend, slide or fade to the new value while acceleratiing gradually and decelerating again to the end. the slide object is just decelerating. It starts too sudden. Does anybody have an idea?
I’m on Windows. I can’t get msd (pmpd) running on my Machine, tried f0.smooth externals with the same results as slide.

thanks
secco

#32688
Jun 30, 2007 at 12:03pm

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 125 151 16 9109513 2.;
#P newex 172 101 51 9109513 onebang 1;
#P flonum 172 240 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 172 196 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 117 61 15 0;
#P newex 117 78 50 9109513 qmetro 5;
#P newex 172 217 59 9109513 slide 10. 10.;
#P newex 172 148 46 9109513 listfunnel;
#P message 143 149 26 9109513 next;
#B color 6;
#N coll ;
#P newobj 172 172 53 9109513 coll;
#P message 172 125 94 9109513 165. 221.1 0.5 -123;
#P comment 135 61 16 9109513 1.;
#P fasten 6 0 10 0 122 99 177 99;
#P fasten 6 0 8 0 122 193 177 193;
#P connect 10 0 1 0;
#P connect 5 0 9 0;
#P connect 8 0 5 0;
#P connect 2 0 8 0;
#P connect 7 0 6 0;
#P fasten 3 0 2 0 148 169 177 169;
#P connect 1 0 4 0;
#P connect 4 0 2 0;
#P window clipboard copycount 12;

but better ask (or serach for slide) in the main max-msp list.

On 6/30/07, secco wrote:
>
>
> Hi all,
>
> I still haven’t found a solution to tis:
> I have randomly incoming values like for example these:
>
> 165.0
> 221.1
> 0.5
> -123
> …
>
> the time between the values is unknown.
> As soon as the value changes I want to blend, slide or fade to the new
> value while acceleratiing gradually and decelerating again to the end. the
> slide object is just decelerating. It starts too sudden. Does anybody have
> an idea?
> I’m on Windows. I can’t get msd (pmpd) running on my Machine, tried
> f0.smooth externals with the same results as slide.
>
> thanks
> secco
>

#107996
Jun 30, 2007 at 12:15pm

oh didnt read it to the end.
this abstracion was found on the main list. there was an object that those
this internally. cant remember the name. mybe lp.scanmpf?

#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 729 516 100 196617 Peter McCulloch 1/2/03 pjm0010@unt.edu;
#P button 499 323 26 0;
#P window linecount 1;
#P message 665 209 78 196617 0 , 100 200 0.2;
#P message 686 228 75 196617 100 , 0 1000 5;
#P message 571 226 84 196617 0 , 100 1000 0.5;
#P message 560 208 84 196617 100 , 0 1000 0.5;
#N vpatcher 237 27 893 773;
#P window setfont “Sans Serif” 9.;
#P comment 394 105 226 196617 I’ve not got the “$1 1000″ sort of argument
sorted yet.;
#P comment 318 630 100 196617 Note: Leads are reversed for f1>f2!;
#P newex 217 415 53 196617 t f f f f;
#B color 13;
#P newex 193 388 53 196617 t f f f f;
#B color 1;
#P newex 249 191 66 196617 t f f f f f;
#P newex 153 191 90 196617 t f f f f f;
#P newex 474 574 32 196617 * -1.;
#B color 10;
#P newex 491 499 33 196617 bondo;
#P newex 474 548 27 196617 – 0.;
#B color 10;
#P newex 491 523 33 196617 + 0.;
#P newex 270 471 38 196617 pow 1.;
#B color 14;
#P newex 270 504 79 196617 scale 0. 1. 0. 1.;
#P newex 270 443 79 196617 scale 0. 1. 0. 1.;
#P message 173 229 35 196617 set $1;
#N comlet Signals End of Ramp;
#P outlet 528 284 15 0;
#P newex 249 150 93 196617 split -0.001 0.001;
#P message 249 170 35 196617 0.001;
#P newex 153 150 93 196617 split -0.001 0.001;
#P message 153 170 35 196617 0.001;
#P newex 545 244 27 196617 t f f;
#B color 14;
#P newex 381 471 38 196617 pow 1.;
#B color 14;
#P newex 545 219 85 196617 if $f1>0 then $f1;
#B color 14;
#N comlet Curve Coefficient. 1=Linear , >1=Expon , <1=Log;
#P inlet 545 185 15 0;
#P outlet 474 617 15 0;
#P newex 327 101 49 196617 zl slice 2;
#N comlet Time Grain in Milliseconds;
#P inlet 417 229 15 0;
#N comlet Total Ramp Time in Milliseconds;
#P inlet 399 228 15 0;
#P newex 270 322 45 196617 bondo;
#P newex 270 348 115 196617 if $f1>$f2 then 2 else 1;
#P newex 270 372 121 196617 gate 2;
#P newex 240 124 95 196617 unpack f f;
#N vpatcher 40 55 181 272;
#N comlet Triples;
#P outlet 67 158 15 0;
#N comlet Doubles;
#P outlet 51 158 15 0;
#N comlet Singles;
#P outlet 35 158 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 35 132 43 196617 gate 3;
#P newex 35 102 32 196617 zl len;
#P newex 18 73 27 196617 t l l;
#P inlet 18 43 15 0;
#P connect 0 0 1 0;
#P connect 1 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 3 1 5 0;
#P connect 3 2 6 0;
#P fasten 1 0 3 1 23 124 73 124;
#P pop;
#P newobj 153 80 184 196617 p listhandler;
#P newex 381 250 47 196617 line 0. 5;
#P newex 381 504 79 196617 scale 0. 1. 1. 0.;
#P newex 381 443 79 196617 scale 0. 1. 0. 1.;
#P inlet 153 56 15 0;
#P comment 21 150 126 196617 “Scale” is not keen on 0′s. (Also important to
avoid NaN errors);
#P comment 49 466 100 196617 Peter McCulloch 1/2/03 pjm0010@unt.edu;
#P comment 392 51 226 196617 n.b. This patch does allow for pass-through
operation on the line object but you may encounter “Input Range of 0″ errors
when going from positive to negative. (Though it still works);
#P comment 392 342 100 196617 If you don’t do this , a decreasing line has
the inverse slope.;
#P comment 419 412 100 196617 Note: Leads are reversed for f1>f2!;
#P connect 5 0 9 0;
#P connect 9 0 23 0;
#P connect 23 0 22 0;
#P connect 22 0 35 0;
#P fasten 23 1 35 0 241 187 158 187;
#P connect 35 1 27 0;
#P connect 35 2 37 0;
#P lcolor 2;
#P fasten 36 1 38 0 268 279 185 279 185 410 222 410;
#P lcolor 14;
#P connect 9 1 10 0;
#P fasten 16 0 10 0 332 121 245 121;
#P connect 10 0 25 0;
#P connect 25 0 24 0;
#P fasten 25 1 36 0 337 188 254 188;
#P connect 24 0 36 0;
#P fasten 35 4 13 0 238 224 275 260;
#P lcolor 8;
#P connect 13 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 28 0;
#P lcolor 11;
#P connect 28 0 30 0;
#P connect 30 0 29 0;
#P fasten 37 2 28 1 226 411 292 411;
#P lcolor 2;
#P fasten 38 2 28 2 250 440 309 440;
#P lcolor 14;
#P fasten 21 0 30 1 550 465 303 465;
#P lcolor 15;
#P connect 36 4 13 1;
#P lcolor 8;
#P fasten 37 0 29 3 198 500 326 500;
#P lcolor 2;
#P fasten 38 0 29 4 222 496 343 496;
#P lcolor 14;
#P connect 9 2 16 0;
#P fasten 13 1 12 1 310 343 380 343;
#P fasten 27 0 8 0 178 247 386 247;
#P fasten 36 0 8 0 254 232 386 232;
#P connect 8 0 11 1;
#P lcolor 11;
#P connect 11 1 6 0;
#P lcolor 11;
#P connect 6 0 20 0;
#P connect 20 0 7 0;
#P fasten 38 3 6 1 264 437 403 437;
#P lcolor 14;
#P connect 14 0 8 1;
#P fasten 10 1 8 1 330 145 394 145 394 246 404 246;
#P fasten 37 3 6 2 240 408 420 408;
#P lcolor 2;
#P fasten 21 1 20 1 567 467 414 467;
#P lcolor 15;
#P connect 15 0 8 2;
#P fasten 37 1 7 3 212 498 437 498;
#P lcolor 2;
#P fasten 38 1 7 4 236 494 454 494;
#P lcolor 14;
#P fasten 7 0 32 0 386 529 479 529;
#P lcolor 11;
#P connect 32 0 34 0;
#P lcolor 11;
#P fasten 35 0 17 0 158 430 330 601 479 601;
#P lcolor 11;
#P fasten 29 0 17 0 275 547 329 601 479 601;
#P lcolor 11;
#P connect 34 0 17 0;
#P lcolor 11;
#P fasten 35 3 33 0 218 220 496 220;
#P connect 33 0 31 0;
#P connect 31 0 32 1;
#P fasten 36 3 33 1 296 218 519 218;
#P connect 33 1 31 1;
#P fasten 8 1 26 0 423 276 533 276;
#P connect 18 0 19 0;
#P lcolor 15;
#P fasten 16 1 19 0 371 211 550 211;
#P lcolor 15;
#P connect 19 0 21 0;
#P lcolor 15;
#P pop;
#P newobj 445 292 64 196617 p curvething;
#P message 455 225 92 196617 100 , -100 1000 2;
#P message 445 207 89 196617 -100 , 100 1000 2;
#P user multiSlider 445 372 274 183 -100. 100. 1 3961 15 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 connect 3 1 8 0;
#P connect 3 0 0 0;
#P connect 1 0 3 0;
#P fasten 4 0 3 0 565 257 450 257;
#P fasten 5 0 3 0 576 259 450 259;
#P fasten 2 0 3 0 460 246 450 246;
#P fasten 7 0 3 0 670 270 450 270;
#P fasten 6 0 3 0 691 272 450 272;
#P window clipboard copycount 10;

On 6/30/07, yair reshef wrote:
>
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #P comment 125 151 16 9109513 2.;
> #P newex 172 101 51 9109513 onebang 1;
> #P flonum 172 240 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 172 196 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P toggle 117 61 15 0;
> #P newex 117 78 50 9109513 qmetro 5;
> #P newex 172 217 59 9109513 slide 10. 10.;
> #P newex 172 148 46 9109513 listfunnel;
> #P message 143 149 26 9109513 next;
> #B color 6;
> #N coll ;
> #P newobj 172 172 53 9109513 coll;
> #P message 172 125 94 9109513 165. 221.1 0.5 -123;
> #P comment 135 61 16 9109513 1.;
> #P fasten 6 0 10 0 122 99 177 99;
> #P fasten 6 0 8 0 122 193 177 193;
> #P connect 10 0 1 0;
> #P connect 5 0 9 0;
> #P connect 8 0 5 0;
> #P connect 2 0 8 0;
> #P connect 7 0 6 0;
> #P fasten 3 0 2 0 148 169 177 169;
> #P connect 1 0 4 0;
> #P connect 4 0 2 0;
> #P window clipboard copycount 12;
>
> but better ask (or serach for slide) in the main max-msp list.
>
> On 6/30/07, secco < secondbox@gmx.net> wrote:
> >
> >
> > Hi all,
> >
> > I still haven’t found a solution to tis:
> > I have randomly incoming values like for example these:
> >
> > 165.0
> > 221.1
> > 0.5
> > -123
> > …
> >
> > the time between the values is unknown.
> > As soon as the value changes I want to blend, slide or fade to the new
> > value while acceleratiing gradually and decelerating again to the end. the
> > slide object is just decelerating. It starts too sudden. Does anybody have
> > an idea?
> > I’m on Windows. I can’t get msd (pmpd) running on my Machine, tried
> > f0.smooth externals with the same results as slide.
> >
> > thanks
> > secco
> >
>
>

#107997
Jun 30, 2007 at 4:30pm

thaks yair,

lp.scampf may be the object. Maybe I can patch something with that somehow but it’s still not exactly what I thought of. I have to slide between values that don’t change gradually but abrupt. Like smoothing a rectangular wave to something sine-like.

cheers
secco

#107998
Jun 30, 2007 at 6:00pm

it will help to learn more about what your trying to accomplish.
sounds like youre trying to smooth input from a sensor.

On 6/30/07, secco wrote:
>
>
> thaks yair,
>
> lp.scampf may be the object. Maybe I can patch something with that somehow
> but it’s still not exactly what I thought of. I have to slide between values
> that don’t change gradually but abrupt. Like smoothing a rectangular wave to
> something sine-like.
>
> cheers
> secco
>

#107999
Jul 1, 2007 at 12:04pm

it’s not from a sensor it’s user input. the user can choose the destination coordinates of different objects. the objects then move to these coordinates. this movement should accelerate and decelerate softly.

#108000
Jul 1, 2007 at 6:31pm

run a search on the main max list for “exponential”

On 7/1/07, secco wrote:
>
>
> it’s not from a sensor it’s user input. the user can choose the
> destination coordinates of different objects. the objects then move to these
> coordinates. this movement should accelerate and decelerate softly.
>

#108001
Jul 1, 2007 at 7:07pm

#108002
Jul 1, 2007 at 7:21pm

#108003
Jul 2, 2007 at 2:11am

#108004
Jul 10, 2007 at 9:34pm

You said the time between the inputs is unknown. However, once some object is clicked, you know how far it is distance-wise and you’ve probably got an idea how long the motion should take (which could be settable too).

I’d scale the distance value to something like 0-255 and use a lookup table for your scaling-per-datapoint function (how far it moves per time-step). Then you can tweak / draw the table just how you want it, or have multiple tables (like: further objects could behave differently, etc.) The cool functions talked about here can be used to fill the tables … then you get to see what they look like graphically, too.

–CJ

#108005

You must be logged in to reply to this topic.