is this what you are looking for ? --- 0 => float threshold; float f; SinOsc o => dac; while (true) { while (threshold < 10000) { Std.rand2f(1,15000) => f; if (f > threshold) { f => threshold; } threshold => o.freq; 100::ms => now; } while (threshold > 10) { Std.rand2f(1,15000) => f; if (f < threshold) { f => threshold; } threshold => o.freq; 100::ms => now; } } --- you didn't define some stuff in your description so I had to improvise. This code has not been tested - I'm not responsible if it eats your children. tom Excerpts from tempjayren's message of mar. août 23 21:01:23 +0200 2011:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'M TRYING TO PICTURE THE CODE TO IMPLEMENT THIS, THOUGH MY BRAIN HURTS, SO I CAN'T. THIS IS SIMILAR TO THE TUTORIAL EXAMPLE THAT IS DESCRIBED AS SOUNDING LIKE OLD SCIFI COMPUTERS. WHERE WE USE A SINOSC AND PLAY WITH THE RANDOM AND THE FREQ. THIS WILL RUN FOREVER, ON FIRST RUN IT WILL GENERATE A NUMBER, SAY 200, IT WILL PLAY A SHORT 200 FREQ FOR SOME SHORT LENGTH, SAY 100MS. ON ITS SECOND RUN, SAY IT GENERATES SOME OTHER NUMBER LIKE 50, THIS IS A BAD NUMBER IN THIS CASE BECAUSE IT IS LOWER THAN 200. SO IT TOSSES OUT THE 50 AND PLAYS ANOTHER 200 FREEQ 100MS BURST ON THE SINOSC. THIRD RUN IT USES SAY 300, THIS IS OVER 200 AND NOT 200 ITSELF, SO IT USES THIS, PLAYS THE NEW TONE. 4TH RUN, 250, NOPE CAN'T USE THIS THE NUMBER HAS TO BE 300. 5TH RUN, REPEAT. - --- SKIP AHEAD --- $TH RUN, 10000 PLAYS THE FREQ AT 100MS OF COURSE, THEN REVERSES THE PROCESS. #TH+1 RUN 9000 LESS THAN 10000 SO WE CAN USE THAT JUST FINE. #TH+2 RUN, 9050, OOPS, CAN'T USE THIS SO WE USE 9000. - --- REPEAT UNTIL WE WGT TO 50 ON THE FREQ, WHERE THE WHOLE THING STARTS OVER AGAIN. -- TERRIBLY SORRY ABOUT THIS, I'VE JUST NOTICED MY CAPSLOCK IS DOING AN ODD THING IT SAYS IT IS OFF, THOUGH IT APPEARS TO BE ON, GROWL, NOT HAPPY plus, i don't feel like retyping all of this, so no i'm not shouting at anyone. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJOU/kCAAoJEIaKvi7tbzRH0aAH/jzSFyLg/XNvwE8ewjnlEs51 1InT5AmBAb/7XZTtp8xBVyfuBi5AQQxKomNkJm9ZqZj/yut7jAgh1oFRbLITcxeu B8UOjzQcjv03s6SMPoFQk1jsZgPm52IjJHraLMTZM/cYZcnsJGg/zpTlcFImGbbi yPd6z6jML1xzmE4J63Aw5nm9/9yD/x0/fugbEHKVmdu3VJRpJtn+kVzTosc5+eT4 kNNN8jXP3AK0oKRqd848EZ/T7bv9DQS+HaErzqkcFv0JVNdd8tzkAwJ74ANxhygS 5cojoDpGQgpl/+03veWICG2qd+DMxDvB9toVRryJn4Y/xHoRckoOain+UBy9mSM= =Jtkw -----END PGP SIGNATURE-----