Forums > MaxMSP

how to have a time dependant average?

October 25, 2006 | 6:01 am

Something like accum but that trends back to zero (or some other value) as time goes on without input.

I’m not sure I’m describing it well but any suggestions?

(I wanna count certain midi messages, and each time there’s a matching message it ups my output value… but as time goes on without input it smoothly goes back to zero)

The domain for this is floats, btw.

Thanks!


October 25, 2006 | 7:54 am

you probably have something else named plugconfig in your path, maybe like plugconfig.txt or something like that.


October 25, 2006 | 11:25 am

> Something like accum but that trends back to zero (or some other value) as
> time goes on without input.

you can use accum, you could also try something with slide, just make sure
that object knows that the time is going on while there is
no input(or if your incoming and outgoing data rate is low, make it know
that the time was going on while there was no input).

try example below.

hth,
nesa

#P user multiSlider 205 305 150 27 -1. 3. 1 3449 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 130 222 93;
#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 Geneva 9.;
#P window linecount 1;
#P comment 310 171 158 9961481 >1 makes output tend to infinity;
#P comment 310 154 158 9961481 makes output tend to zero ;;
#P comment 310 141 134 9961481 vales between 0 and 1;
#P comment 310 117 159 9961481 by this value on each metro tick.;
#P comment 186 65 113 9961481 the TIME:;
#P button 183 276 15 0;
#P hidden newex 135 29 45 9961481 loadbang;
#P flonum 263 136 44 9 0 0 0 152 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 205 156 68 9961481 0.995;
#B color 1;
#P flonum 205 276 78 9 0 0 0 152 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 205 182 48 9961481 t b f;
#B color 1;
#P toggle 205 87 15 0;
#P newex 205 111 50 9961481 metro 10;
#B color 1;
#P message 190 222 14 9961481 0;
#P toggle 85 92 15 0;
#P newex 85 111 56 9961481 metro 700;
#P message 45 112 20 9961481 16;
#P number 95 160 35 9 0 0 0 152 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 85 181 35 9961481 == 16;
#P newex 205 245 48 9961481 accum 0.;
#P button 67 111 15 0;
#P newex 85 138 56 9961481 random 24;
#P user panel 37 80 116 130;
#X brgb 186 210 201;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 37 65 113 9961481 your number matching:;
#P comment 310 104 135 9961481 value in accum is multiplied;
#P user panel 185 79 305 132;
#X brgb 229 224 184;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 284 276 100 9961481 output value;
#P user panel 170 266 185 33;
#X brgb 130 222 93;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 18 0 28 0;
#P hidden connect 21 0 13 0;
#P lcolor 1;
#P hidden connect 21 0 16 0;
#P lcolor 1;
#P fasten 8 0 22 0 210 271 188 271;
#P connect 8 0 18 0;
#P connect 6 0 9 0;
#P connect 6 0 10 0;
#P connect 15 0 19 0;
#P connect 19 0 17 0;
#P connect 20 0 19 1;
#P fasten 9 0 8 1 90 215 229 215;
#P lcolor 9;
#P connect 16 0 15 0;
#P connect 17 1 8 2;
#P lcolor 2;
#P connect 17 0 8 0;
#P lcolor 2;
#P connect 7 0 6 0;
#P connect 12 0 6 0;
#P fasten 14 0 8 0 195 241 210 241;
#P connect 13 0 12 0;
#P fasten 11 0 9 0 50 169 90 169;
#P window clipboard copycount 29;


October 26, 2006 | 6:28 am

Ah, yes, nice! thanks, perfect!


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