looping issue

May 1, 2006 at 6:23pm

looping issue

trying to make a simple patch that will add one each time a loop finishes, but cant get passed the first hurdle.

here i hjave simulated the output of a groove~ oobject with a phasor~

in theory, it should bang each time it reaches 0.99, which is accurate enough for my purpose, but it doesnt work at all!!!

can anyone help?

#P toggle 409 289 15 0;
#P button 376 276 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 379 249 47 196617 sel 0.99;
#P user ezdac~ 307 391 351 424 0;
#P flonum 320 236 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 320 196 64 196617 snapshot~ 1;
#P user multiSlider 320 288 12 82 0. 1. 1 2681 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 newex 320 164 70 196617 phasor~ 0.08;
#P connect 5 0 6 0;
#P connect 5 0 7 0;
#P connect 3 0 1 0;
#P connect 3 0 5 0;
#P connect 2 0 3 0;
#P connect 0 0 2 0;
#P window clipboard copycount 8;

#25737
May 1, 2006 at 7:18pm

hi john,

i cant open your patch at the moment i dont have max
on this machine but i think the ‘>=’ object and
‘change’ object should do the job for you.

hope it helps

j.

#76112
May 1, 2006 at 7:31pm

May be this?

max v2;
#N vpatcher 26 128 363 577;
#P origin 0 33;
#P window setfont “Sans Serif” 9.;
#P newex 102 91 60 196617 loadmess 1;
#P newex 131 251 39 196617 > 0.98;
#P number 102 117 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 131 303 15 0;
#P newex 131 277 32 196617 sel 1;
#P user ezdac~ 89 370 133 403 0;
#P flonum 102 215 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 102 175 64 196617 snapshot~ 1;
#P user multiSlider 102 267 12 82 0. 1. 1 2681 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 newex 102 143 70 196617 phasor~ 0.08;
#P connect 9 0 7 0;
#P connect 7 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 1 0;
#P connect 3 0 8 0;
#P connect 8 0 5 0;
#P connect 5 0 6 0;
#P pop;

#76113
May 1, 2006 at 7:34pm

Your [select] expects precisely 0.99, but I don’t think we can guarantee
that — you have [snapshot~] in self-clocking, so we don’t know exactly
where it’s going to land.

max v2;
#N vpatcher 408 504 1170 1022;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 54 162 39 9109513 >= 0.99;
#P toggle 54 196 21 0;
#P user ezdac~ 30 260 74 293 0;
#P flonum 31 110 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 31 70 59 9109513 snapshot~ 1;
#P user multiSlider 31 162 12 82 0. 1. 1 2681 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 newex 31 38 62 9109513 phasor~ 0.08;
#P connect 0 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 1 0;
#P connect 3 0 6 0;
#P connect 6 0 5 0;
#P pop;

#76114
May 1, 2006 at 7:40pm

thanks guys, this object worked

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 437 289 113 196617 if $f1 > 0.99 then bang;
#P window clipboard copytext “if $f1 > 0.99 then bang” #E;
#P window clipboard copycount

what i need now is a way to count the bangs up, i think there is an object for this?!?!?

#76115
May 1, 2006 at 7:44pm

i got this, but it jumps up each time, rather than simply adding one

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 419 151 31 196617 0.01;
#N vpatcher 10 59 610 459;
#P origin 0 29;
#P window setfont “Sans Serif” 9.;
#P newex 245 54 25 196617 iter;
#N vpatcher 20 74 420 374;
#P outlet 181 131 15 0;
#P inlet 159 55 15 0;
#P connect 0 0 1 0;
#P pop;
#P newobj 248 140 13 196617 p;
#P newex 245 104 34 196617 sel 0.;
#P newex 212 104 31 196617 sel 0;
#P newex 311 211 31 196617 print;
#P newex 193 179 21 196617 t 1;
#P message 221 183 14 196617 0;
#P user gswitch2 63 107 39 32 1 0;
#N comlet value to round to the nearest of;
#P inlet 223 10 15 0;
#P newex 280 109 21 196617 t 0;
#P newex 188 73 21 196617 t 1;
#P user gswitch 81 461 41 32 0 0;
#P number 128 434 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 223 75 72 196617 route int float;
#N comlet rounded output;
#P outlet 81 570 15 0;
#N comlet value to round;
#P inlet 92 81 15 0;
#P message 376 138 14 196617 0;
#P message 315 138 14 196617 1;
#P newex 304 107 133 196617 sel round r truncate trunc t;
#P newex 304 73 59 196617 route mode;
#P newex 109 299 55 196617 gate 1 1;
#P number 154 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 139 268 127 196617 – 0.;
#P user gswitch 109 360 41 32 1 0;
#P newex 154 218 95 196617 expr $f1>=($f2/2);
#P flonum 129 197 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 129 176 30 196617 % 0.;
#P flonum 92 434 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 92 151 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 247 29 72 196617 patcherargs 1;
#P newex 92 402 27 196617 – 0.;
#P fasten 25 0 23 0 129 73 68 73;
#P fasten 24 0 23 0 128 70 68 70;
#P fasten 21 0 19 0 295 212 260 352 198 436 56 436 42 406 54 379 86 379;
#P fasten 20 0 19 0 193 137 86 145 86 364;
#P fasten 23 0 16 0 68 404 30 471 49 514 49 542 86 542;
#P connect 19 0 16 0;
#P connect 15 0 23 1;
#P connect 23 1 2 0;
#P connect 2 0 0 0;
#P connect 0 0 3 0;
#P connect 3 0 19 1;
#P fasten 13 0 10 0 302 198;
#P fasten 14 0 10 0 363 191;
#P connect 10 0 7 0;
#P connect 7 0 0 1;
#P connect 18 0 19 2;
#P connect 5 0 7 1;
#P connect 0 0 18 0;
#P connect 2 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 7 2;
#P connect 29 0 4 1;
#P connect 5 0 6 0;
#P connect 6 0 9 0;
#P connect 9 0 10 1;
#P connect 17 0 20 0;
#P connect 29 0 25 0;
#P connect 17 0 27 0;
#P connect 27 0 24 0;
#P connect 28 0 24 0;
#P connect 22 0 17 0;
#P connect 30 0 17 0;
#P connect 29 0 6 1;
#P connect 1 0 30 0;
#P connect 17 1 28 0;
#P connect 17 2 28 0;
#P connect 28 1 29 0;
#P connect 27 1 29 0;
#P fasten 29 0 8 1 261 228;
#P connect 17 1 21 0;
#P connect 1 1 11 0;
#P connect 11 0 12 0;
#P connect 12 1 13 0;
#P connect 12 0 13 0;
#P connect 12 4 14 0;
#P connect 12 3 14 0;
#P connect 12 2 14 0;
#P pop;
#P newobj 324 184 56 196617 p rounding;
#P number 437 354 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N counter;
#X flags 0 0;
#P newobj 437 328 66 196617 counter;
#P newex 437 289 113 196617 if $f1 > 0.99 then bang;
#P user ezdac~ 307 391 351 424 0;
#P newex 320 138 64 196617 snapshot~ 1;
#P user multiSlider 320 288 12 82 0. 1. 1 2681 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 newex 320 106 70 196617 phasor~ 0.08;
#P flonum 320 236 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 9 0 8 1;
#P connect 8 0 0 0;
#P connect 3 0 8 0;
#P connect 6 0 7 0;
#P connect 0 0 5 0;
#P connect 0 0 2 0;
#P connect 5 0 6 0;
#P connect 1 0 3 0;
#P window clipboard copycount 10;

#76116
May 1, 2006 at 7:58pm

You forgot arguments for your [counter].
(check the help — it’s pretty straighforward)

–raf.

#76117
May 1, 2006 at 8:00pm

On 1 May 2006, at 20:40, John wrote:
>
> what i need now is a way to count the bangs up, i think there is an
> object for this?!?!?

counter ???

david

#76118
May 1, 2006 at 8:07pm

#76119
May 1, 2006 at 8:10pm

i dont think i need arguements, i think the fault is in the if statement outputtinng too many bangs

#76120
May 1, 2006 at 8:12pm

On May 1, 2006, at 3:40 PM, John wrote:
> what i need now is a way to count the bangs up, i think there is an
> object for this?!?!?

[counter]

—–
Nathan Wolek
nw@nathanwolek.com

http://www.nathanwolek.com

#76121
May 1, 2006 at 8:18pm

now this is what i have.

i want to round up the results to the nearest 0.01

any ideas?

#P window setfont “Sans Serif” 9.;
#P flonum 843 527 69 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 844 502 31 196617 + 0.;
#P newex 813 304 40 196617 change;
#P message 938 344 14 196617 0;
#P newex 813 324 32 196617 sel 1;
#P number 896 406 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 896 350 15 0;
#N counter;
#X flags 0 0;
#P newobj 896 373 66 196617 counter;
#P newex 813 259 53 196617 >= 0.99;
#P toggle 813 279 21 0;
#P user ezdac~ 789 367 833 400 0;
#P flonum 790 217 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 790 177 59 196617 snapshot~ 1;
#P user multiSlider 790 269 12 82 0. 1. 1 2681 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 newex 790 145 76 196617 phasor~ 0.08;
#P connect 0 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 1 0;
#P connect 3 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 12 0;
#P connect 12 0 10 0;
#P connect 13 0 14 0;
#P connect 3 0 13 0;
#P connect 9 0 13 1;
#P fasten 10 0 8 0 818 343 901 343;
#P connect 8 0 7 0;
#P connect 7 0 9 0;
#P connect 11 0 7 3;
#P window clipboard copycount 15;

#76122
May 1, 2006 at 9:12pm

Hmmmn, shouldn’t trust a fellow noob, I reckon :-)
(which I am, again — after a *very* long layoff)

I hope things are going well for you now!

–raf.

John wrote:
> i dont think i need arguements, i think the fault is in the if statement outputtinng too many bangs

#76123
May 1, 2006 at 9:42pm

Least objects, maximum accuracy

best, Thijs

#P window setfont “Sans Serif” 9.;
#P number 941 375 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 983 322 15 9109513 0;
#N counter;
#X flags 0 0;
#P newobj 941 347 66 9109513 counter;
#P button 909 319 15 0;
#P newex 941 291 50 9109513 edge~;
#P newex 942 265 31 9109513 ==~ 1;
#P flonum 944 188 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 943 237 64 9109513 change~;
#P newex 944 211 70 9109513 phasor~ 0.08;
#P connect 6 0 8 0;
#P connect 4 0 5 0;
#P connect 4 0 6 0;
#P connect 7 0 6 3;
#P connect 3 0 4 0;
#P connect 1 0 3 0;
#P connect 0 0 1 0;
#P connect 2 0 0 0;
#P window clipboard copycount 9;

#76124
May 2, 2006 at 7:45pm

May I offer this to characterize your version: “Make no assumptions.”

(John — note that Thijs’s patch has no constants, like 0.99, to
arbitrarily define the “top of ramp”)

–raf.

Thijs Koerselman wrote:
> Least objects, maximum accuracy

#76125
May 2, 2006 at 8:51pm

true true. I sounded a little too confident there… but it’s just the best
way damnit ;-)

cheers, thijs

#76126
May 3, 2006 at 1:17am

Thanks Thijs,

For ages i’ve been using: phasor~ + delta~ + >=~ 0. + edge~ and your method is miles better at catching the transitions when phasor~ is running at high rates.

cheers,

john

#76127
May 3, 2006 at 5:17am

John wrote:
> in theory, it should bang each time it reaches 0.99, which is
> accurate enough for my purpose, but it doesnt work at all!!!
>
> can anyone help?

I recommend to do this kind of stuff with edge~,
snapshot is bad and eats all your scheduler cycles which you might need
elsewhere…

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 125 137 50 196617 edge~;
#P toggle 157 161 15 0;
#P button 125 161 15 0;
#P newex 125 115 50 196617 < ~ 0.5;
#P newex 125 88 73 196617 phasor~ 0.08;
#P connect 0 0 1 0;
#P connect 4 0 2 0;
#P fasten 4 0 3 0 130 157 162 157;
#P fasten 1 0 4 0 130 134;
#P window clipboard copycount 5;

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09

#76128
May 3, 2006 at 12:11pm

why does 0.5 work when i need it to wait until 1?

#76129
May 3, 2006 at 1:04pm

< ~ 0.5 will output 1. when the signal goes back to 0.

edge~ left outlet will bang when there is a transition from 0. to above 0.

#76130
May 3, 2006 at 1:29pm

so what does the arg 0.5 actually mean?

#76131
May 3, 2006 at 4:50pm

not sure what you mean, maybe this helps ?

#P user multiSlider 181 299 165 24 0. 1. 1 2680 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 181 273 70 196617 snapshot~ 10;
#P toggle 77 226 15 0;
#P newex 77 204 70 196617 snapshot~ 10;
#P window linecount 4;
#P comment 257 354 100 196617 bang when ramp gets above 0.5…i.e. bang on non-zero to zero transitions.;
#P button 257 337 15 0;
#P window linecount 2;
#P comment 138 354 100 196617 bang on zero to non-zoro transitions;
#P flonum 67 62 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 72 346 116 379 0;
#P window linecount 1;
#P newex 67 251 50 196617 edge~;
#P button 181 337 15 0;
#P newex 67 176 50 196617 < ~ 0.5;
#P newex 67 84 58 196617 phasor~ 1.;
#P window linecount 4;
#P comment 75 126 100 196617 it means that if the ~ is less than 0.5 , the output is 1 , if above 0.5 the output is 0.;
#P window linecount 1;
#P comment 258 322 13 196617 ?;
#P fasten 3 0 5 0 72 195;
#P connect 3 0 11 0;
#P connect 2 0 3 0;
#P fasten 2 0 13 0 72 115 186 115;
#P connect 7 0 2 0;
#P fasten 5 0 4 0 72 327 186 327;
#P fasten 5 1 9 0 112 325 262 325;
#P connect 13 0 14 0;
#P connect 11 0 12 0;
#P window clipboard copycount 15;

#76132

You must be logged in to reply to this topic.