Smoothing out between two successive numbers (peakamp~ and scale)

Feb 19, 2007 at 11:58pm

Smoothing out between two successive numbers (peakamp~ and scale)

I’m using peakamp~ to drive a display and unfortunately the numbers have to be scaled to be of any use to me. As such the sudden jump from one value to the next 50ms value from peakamp~ is quite noticable so I have tried smoothing the jump between the successive outputs using line.

The problem is that it doesnt seem to work so well and I was wondering if anyone has any advice?

max v2;
#N vpatcher 66 187 738 660;
#P window setfont “Sans Serif” 9.;
#P flonum 391 399 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 43 271 93 196617 scale 0. 1. 0. 100.;
#P newex 43 295 38 196617 s Amp;
#P window setfont “Fixedwidth Serif” 10.;
#P flonum 43 244 59 10 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 43 223 76 1441802 peakamp~ 50;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P newex 170 40 48 196617 loadbang;
#P user ezdac~ 170 207 214 240 0;
#P message 224 98 51 196617 startloop;
#P toggle 170 87 15 0;
#P newex 170 120 27 196617 sig~;
#P newex 170 169 70 196617 groove~ Test;
#P message 39 94 43 196617 replace;
#P newex 39 117 67 196617 buffer~ Test;
#P button 437 248 15 0;
#P button 300 250 15 0;
#P newex 459 333 40 196617 line 0.;
#P message 459 300 138 196617 0. , 0. 50;
#P message 328 299 142 196617 0. , 0. 50;
#P newex 459 175 49 196617 pak 0. 0.;
#P newex 328 177 49 196617 pak 0. 0.;
#P message 459 205 82 196617 set $2 \, $1 50;
#P message 328 204 82 196617 set $1 \, $2 50;
#P flonum 328 144 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 497 146 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 378 58 15 0;
#P user gswitch2 378 85 39 32 1 0;
#P newex 328 332 40 196617 line 0.;
#P newex 407 30 38 196617 r Amp;
#P window setfont “Sans Serif” 12.;
#P window linecount 8;
#P comment 96 296 180 196620 I’m trying to smooth out the change between one value and the next (every 50 ms) from peakamp~ so there is no sudden leap that is noticable when the data is scaled up to a more useful size.;
#P connect 17 0 16 0;
#P connect 18 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 27 0;
#P connect 27 0 26 0;
#P connect 23 0 20 0;
#P connect 20 0 19 0;
#P connect 19 0 18 0;
#P connect 21 0 18 0;
#P connect 18 0 22 0;
#P connect 18 0 22 1;
#P connect 7 0 14 0;
#P connect 3 0 6 0;
#P connect 6 0 9 0;
#P connect 9 0 7 0;
#P connect 7 0 11 0;
#P connect 14 0 11 0;
#P connect 11 0 2 0;
#P connect 5 0 9 1;
#P connect 1 0 4 0;
#P connect 4 0 3 0;
#P connect 13 0 28 0;
#P connect 2 0 28 0;
#P connect 1 0 3 1;
#P connect 8 0 15 0;
#P connect 6 0 10 0;
#P connect 10 0 8 0;
#P connect 8 0 12 0;
#P connect 15 0 12 0;
#P connect 12 0 13 0;
#P connect 3 1 5 0;
#P connect 5 0 10 1;
#P pop;

Thanks,

Rhys

#30355
Feb 20, 2007 at 12:03am

instead of interpolating every n ms, try using a signal filter
such as slide~ or biquad~.

#96903
Feb 20, 2007 at 12:15am

Forgive me for being ignorant but I’m not sure I follow you. I’ve not used slide~ before neither.

…I’ll have a look at the help files though.

#96904
Feb 20, 2007 at 1:12am

#96905
Feb 20, 2007 at 6:32am

Rhys Perkins wrote:
> I’m using peakamp~ to drive a display and unfortunately the numbers
> have to be scaled to be of any use to me. As such the sudden jump
> from one value to the next 50ms value from peakamp~ is quite
> noticable so I have tried smoothing the jump between the successive
> outputs using line.

Its not clear what you want to do with the amplitude value, when I read
your question I thought you’re controling audio, but all after peakamp~
is just plain Max. What does make it noticable? Maybe you want to atodb
the output instead of scaling?

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#96906
Feb 20, 2007 at 11:06am

On 20-Feb-2007, at 0:58, Rhys Perkins wrote:

> I’m using peakamp~ to drive a display and unfortunately the numbers
> have to be scaled to be of any use to me. As such the sudden jump
> from one value to the next 50ms value from peakamp~ is quite
> noticable so I have tried smoothing the jump between the successive
> outputs using line.

Your patch is too complicated by half. See the right half of the
enclosed.

For long-term smoothing, I generally use lp.stacey from the Litter
Starter Pack (free download from the URI below). I’ve included use of
this in the following patch, too.

#P user multiSlider 407 176 157 65 0. 100. 1 3961 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 154 102;
#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” 9.;
#P window linecount 1;
#P newex 407 58 61 196617 pack 0. 50;
#P flonum 82 303 53 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 43 280 92 196617 lp.stacey 10;
#P flonum 407 125 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 43 331 146 196617 lp.scampf map 0. 1. 0. 100.;
#P newex 43 355 38 196617 s Amp;
#P window setfont “Fixedwidth Serif” 10.;
#P flonum 43 244 59 10 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 43 223 76 1441802 peakamp~ 50;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P newex 170 40 48 196617 loadbang;
#P user ezdac~ 170 207 214 240 0;
#P message 224 98 51 196617 startloop;
#P toggle 170 87 15 0;
#P newex 170 120 27 196617 sig~;
#P newex 170 169 70 196617 groove~ Test;
#P message 39 94 43 196617 replace;
#P newex 39 117 67 196617 buffer~ Test;
#P newex 407 90 57 196617 line 0. 50;
#P newex 407 30 38 196617 r Amp;
#P window setfont “Sans Serif” 12.;
#P window linecount 2;
#P comment 96 356 180 196620 Stacey smooths out the values;
#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 473 81 100 196617 Much simpler way to do linear
interpolation;
#P connect 16 0 20 0;
#P connect 19 0 3 0;
#P connect 2 0 19 0;
#P connect 3 0 16 0;
#P connect 15 0 14 0;
#P fasten 18 0 15 0 87 324 48 324;
#P connect 17 3 18 0;
#P connect 13 0 17 0;
#P connect 6 0 12 0;
#P connect 6 0 10 0;
#P connect 6 0 10 1;
#P connect 9 0 6 0;
#P connect 7 0 6 0;
#P connect 8 0 7 0;
#P connect 11 0 8 0;
#P connect 12 0 13 0;
#P connect 5 0 4 0;
#P window clipboard copycount 21;

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

#96907

You must be logged in to reply to this topic.