Forums > MaxMSP

If object does not changes the number I want to

March 26, 2008 | 9:01 am

Dear Reader,

I am trying to get some distances, delays for audio samples using some math. The if object triggers a number, which should be multiplied by itself. It does not do it…

please have a look in this small patch if you have a spare minute:

all the best,
Krisztian

max v2;
#N vpatcher 4 44 1280 800;
#P window setfont "Sans Serif" 9.;
#P newex 1198 713 34 196617 delay;
#P button 593 394 15 0;
#P button 732 392 15 0;
#P flonum 732 359 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P newex 651 301 91 196617 if $f1 < $f2 then set $f1 else out2 $f1;
#P flonum 593 358 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 512 300 91 196617 if $f1 < $f2 then set $f1 else out2 $f1;
#P window linecount 1;
#P newex 756 171 29 196617 * 0.;
#P flonum 756 199 79 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 756 142 56 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 756 254 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 756 229 34 196617 / 45.;
#P newex 651 173 29 196617 * 0.;
#P flonum 651 201 92 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 651 144 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 651 256 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 651 231 34 196617 / 45.;
#P button 467 391 15 0;
#P button 328 393 15 0;
#P flonum 73 106 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 1110 50 29 196617 * 0.;
#P flonum 1110 78 92 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1110 21 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 467 358 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P newex 386 300 91 196617 if $f1 < $f2 then set $f1 else out2 $f1;
#P flonum 328 357 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 247 299 91 196617 if $f1 < $f2 then set $f1 else out2 $f1;
#P window linecount 1;
#P newex 512 172 29 196617 * 0.;
#P flonum 512 200 79 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 512 143 56 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 512 255 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 512 230 34 196617 / 45.;
#P newex 386 172 29 196617 * 0.;
#P flonum 386 200 92 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 386 143 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 386 255 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 386 230 34 196617 / 45.;
#P newex 248 176 29 196617 * 0.;
#P flonum 248 204 105 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 248 147 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 248 259 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 248 234 34 196617 / 45.;
#P newex 143 178 29 196617 * 0.;
#P flonum 143 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 37 67 17 196617 9.;
#P flonum 143 149 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 143 261 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 143 236 34 196617 / 45.;
#P window linecount 9;
#P comment 384 23 100 196617 here I can not see the multiplied number when just triggered with the if before —– though it works whenever I changer the top numbers , how comes?;
#P connect 4 0 29 0;
#P connect 29 0 3 0;
#P connect 3 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 1 0;
#P connect 1 0 2 0;
#P connect 3 0 6 1;
#P connect 8 0 22 0;
#P connect 2 0 9 0;
#P connect 9 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 7 0;
#P connect 7 0 8 0;
#P connect 9 0 11 1;
#P connect 2 0 22 1;
#P connect 22 1 23 0;
#P connect 23 0 30 0;
#P connect 22 0 14 0;
#P connect 14 0 16 0;
#P connect 16 0 15 0;
#P connect 15 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 24 0;
#P connect 14 0 16 1;
#P connect 8 0 24 1;
#P connect 24 1 25 0;
#P connect 25 0 31 0;
#P connect 24 0 19 0;
#P connect 19 0 21 0;
#P connect 21 0 20 0;
#P connect 20 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 42 0;
#P connect 19 0 21 1;
#P connect 13 0 42 1;
#P connect 42 1 43 0;
#P connect 43 0 47 0;
#P connect 42 0 34 0;
#P connect 34 0 36 0;
#P connect 36 0 35 0;
#P connect 35 0 32 0;
#P connect 32 0 33 0;
#P connect 33 0 44 0;
#P connect 34 0 36 1;
#P connect 18 0 44 1;
#P connect 44 1 45 0;
#P connect 45 0 46 0;
#P connect 44 0 39 0;
#P connect 39 0 41 0;
#P connect 41 0 40 0;
#P connect 40 0 37 0;
#P connect 37 0 38 0;
#P connect 39 0 41 1;
#P connect 26 0 28 0;
#P connect 28 0 27 0;
#P connect 26 0 28 1;
#P pop;


March 26, 2008 | 9:30 am

your if:

[if $f1 < $f2 then set $f1 else out2 $f1]

Since $f1 < $f2 for numbers smaller than 45, it will perform [set $f1], which is what it does, it sets the next numbox...but does not generate output. Get rid of the 'set'?

#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 159 364 100 196617 you sure you need the ‘set’ in there?;
#P comment 322 440 100 196617 triggering 50 or 60 outputs here;
#P window linecount 1;
#P message 261 127 20 196617 60;
#P message 239 127 20 196617 50;
#P message 195 127 20 196617 30;
#P message 141 127 17 196617 9.;
#P button 435 419 15 0;
#P flonum 452 419 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 517 419 15 0;
#P flonum 533 419 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 245 419 15 0;
#P flonum 262 419 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 217 127 20 196617 40;
#P button 327 419 15 0;
#P flonum 98 127 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P newex 452 360 91 196617 if $f1 < $f2 then set $f1 else out2 $f1;
#P flonum 343 419 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 262 359 91 196617 if $f1 < $f2 then set $f1 else out2 $f1;
#P window linecount 1;
#P newex 452 232 29 196617 * 0.;
#P flonum 452 260 92 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 452 203 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 452 315 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 452 290 34 196617 / 45.;
#P newex 263 236 29 196617 * 0.;
#P flonum 263 264 105 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 263 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 263 319 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 263 294 34 196617 / 45.;
#P newex 158 238 29 196617 * 0.;
#P flonum 158 266 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 158 209 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 158 321 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 158 296 34 196617 / 45.;
#P window linecount 3;
#P comment 422 163 100 196617 triggering 30 or 40 sets the top box , but does not output it;
#P connect 31 0 3 0;
#P connect 30 0 3 0;
#P connect 29 0 3 0;
#P connect 28 0 3 0;
#P connect 18 1 25 0;
#P connect 18 1 24 0;
#P connect 18 0 27 0;
#P connect 18 0 26 0;
#P connect 16 0 23 0;
#P connect 16 0 22 0;
#P connect 16 0 13 0;
#P connect 13 0 15 0;
#P connect 13 0 15 1;
#P connect 7 0 16 0;
#P connect 7 0 18 1;
#P connect 16 1 20 0;
#P connect 16 1 17 0;
#P connect 21 0 3 0;
#P connect 12 0 18 0;
#P connect 11 0 12 0;
#P connect 14 0 11 0;
#P connect 15 0 14 0;
#P connect 2 0 8 0;
#P connect 2 0 16 1;
#P connect 8 0 10 0;
#P connect 8 0 10 1;
#P connect 6 0 7 0;
#P connect 9 0 6 0;
#P connect 10 0 9 0;
#P connect 3 0 5 0;
#P connect 3 0 5 1;
#P connect 1 0 2 0;
#P connect 4 0 1 0;
#P connect 5 0 4 0;
#P connect 19 0 3 0;
#P window clipboard copycount 34;


March 26, 2008 | 9:34 am

On 26 Mar 2008, at 10:01, tedor wrote:
>
> Dear Reader,
>
> I am trying to get some distances, delays for audio samples using
> some math. The if object triggers a number, which should be
> multiplied by itself. It does not do it…

cause you are using the "set" command, which only _sets_ a number
(e.g. for display in a numberbox), but doesn’t output it.
skip the "set" in your if construction and all will be fine.
vb


March 26, 2008 | 9:54 am

oh, thank you,

this seams more intelligent than what I have done… I just added a bang parallel with the number from if…

anyway, no more questions…

thank you!

max v2;
#N vpatcher 4 44 1280 800;
#P button 441 121 15 0;
#P hidden button 261 340 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden message 323 322 14 196617 0;
#P flonum 532 321 69 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 441 323 72 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 602 447 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P newex 533 388 79 196617 if $f1 < = $f2 then set $f1 else out2 $f1;
#P flonum 339 321 69 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 248 323 72 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 248 286 101 196617 if $f1 < = 0.2 then set $f1 else out2 $f1;
#P window linecount 1;
#P newex 1198 713 34 196617 delay;
#P flonum 73 106 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 1110 50 29 196617 * 0.;
#P flonum 1110 78 92 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1110 21 76 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 441 284 101 196617 if $f1 < = 0.2 then set $f1 else out2 $f1;
#P flonum 408 447 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P newex 339 388 79 196617 if $f1 < = $f2 then set $f1 else out2 $f1;
#P window linecount 1;
#P newex 441 173 32 196617 * 0.;
#P flonum 441 201 92 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 441 146 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 441 256 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 441 231 34 196617 / 45.;
#P newex 248 176 29 196617 * 0.;
#P flonum 248 204 105 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 248 147 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 248 259 101 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 248 234 34 196617 / 45.;
#P newex 143 178 29 196617 * 0.;
#P flonum 143 206 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 37 67 17 196617 9.;
#P flonum 143 149 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 143 261 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 143 236 34 196617 / 45.;
#P window linecount 3;
#P comment 462 105 100 196617 I added a bang…. to let it triggered as well.;
#P connect 4 0 23 0;
#P connect 23 0 3 0;
#P connect 3 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 1 0;
#P connect 1 0 2 0;
#P connect 3 0 6 1;
#P fasten 2 0 9 0 148 290 233 290 233 133 253 133;
#P connect 9 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 25 0;
#P connect 25 0 26 0;
#P hidden connect 26 0 33 0;
#P connect 9 0 11 1;
#P hidden connect 33 0 32 0;
#P hidden connect 32 0 27 0;
#P connect 25 1 27 0;
#P connect 27 0 17 0;
#P fasten 2 0 17 1 148 350 413 350;
#P connect 17 1 18 0;
#P fasten 17 0 34 0 344 439 425 439 425 117 446 117;
#P fasten 17 0 14 0 344 438 424 438 424 140 446 140;
#P connect 34 0 14 0;
#P connect 14 0 16 0;
#P connect 16 0 15 0;
#P connect 15 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 19 0;
#P connect 19 0 30 0;
#P connect 14 0 16 1;
#P connect 19 1 31 0;
#P connect 31 0 28 0;
#P fasten 8 0 28 1 253 280 430 280 430 353 607 353;
#P connect 28 1 29 0;
#P connect 20 0 22 0;
#P connect 22 0 21 0;
#P connect 20 0 22 1;
#P pop;


March 26, 2008 | 10:57 am

Yeah dude, don’t add a bang (its a visual gui part as well), but just remove the word set from your if object…now it works the same as ‘prepend set’. Meant to make that clear to you in my earlier post…


March 26, 2008 | 2:11 pm

thanks guys,

I left the ‘set’ behind, with my previous post I just wanted to show how someone uses the longer path whenever he does not know the objects well enough:) -this is why I love this forum; deep in my mother-village on my holidays I am still connected with the core:)

all the best,
Krisztian


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