XML Feeds

.

[maxmsp] C-like expressions and formulas

volker böhm vboehm at gmx.ch
Sun Dec 9 04:19:29 MST 2007


On 09 Dec 2007, at 07:17, Dean wrote:

> Dear Max list,
> I have this value from a potentiometer that jitters about three  
> digits,
> even if I'm not moving it. I used this expression from someone. It  
> worked
> to some extent:
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 893 208 27 196617 f;
> #B color 5;
> #P newex 855 185 122 196617 expr 0.1*$f1 + 0.9*$f2;
> #B color 5;
> #P connect 0 0 1 0;
> #P connect 1 0 0 1;
> #P window clipboard copycount 2;

what you have here is a simple recursive lowpass filter of the form:
y[n] = a*x[n] + b*y[n-1], where a = 1.-b

instead of concatenating more and more of these, i would propose to
simply change the weight (a and b) of x[n] (input) and y[n-1] (last  
output, fed back to input).
or you might like to have a look at [slide], which is a more  
versatile filter for exactly these purposes.
hth,
volker.

ps: it might be a good idea to stabilize the sensor data *before*  
digitizing it.

#P user multiSlider 180 448 183 109 0. 127. 1 3433 15 0 0 2 0 0 0;
#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" 9.;
#P window linecount 1;
#P newex 58 157 67 196617 slide 10. 10.;
#P flonum 271 125 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user multiSlider 180 336 183 109 0. 127. 1 3433 15 0 0 2 0 0 0;
#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 180 224 183 109 0. 127. 1 3433 15 0 0 2 0 0 0;
#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 toggle 139 32 15 0;
#P newex 139 60 52 196617 metro 50;
#P newex 139 96 71 196617 drunk 127 10;
#P newex 139 178 27 196617 f;
#B color 5;
#P newex 139 156 143 196617 expr (1-$f3)*$f1 + $f3*$f2;
#B color 5;
#P comment 310 127 100 196617 0. <-> 1.;
#P connect 8 0 1 2;
#P connect 3 0 9 0;
#P connect 3 0 1 0;
#P connect 3 0 6 0;
#P connect 2 0 7 0;
#P connect 2 0 1 1;
#P connect 9 0 10 0;
#P connect 1 0 2 0;
#P connect 4 0 3 0;
#P connect 5 0 4 0;
#P window clipboard copycount 11;



More information about the maxmsp mailing list