[chuck-users] something new to think about.

David Elkin-Ginnetti franticflamingo5 at gmail.com
Tue Aug 23 18:27:56 EDT 2011


How about defining the threshold initially as a greater frequency and then only allowing it to deviate a specified number from the original frequency? That way it won't always increase as quickly. So, I'm thinking, in the beginning, instead of 0 => float threshold, replacing that with

200 => float threshold;

and then instead of both instances of Std.rand2f(1, 15000):

Std.rand2f( threshold-300, threshold+300 );

That way the frequency couldn't go up more than 300 hz (or some other number) at a time. Does that sound more like you were thinking? Warning: code also hasn't been tested.

peace,
David Elkin-Ginnetti



On Aug 23, 2011, at 17:35, tempjayren at gmail.com wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> i've managed to snip that and run it inside chuck, yay, though each
> time it runs it sounds the same, so that's not good.
> and it doesn't sound like i was expecting either, so that's not good.
> what did i forget to define in my description?
> i'm trying to read the code, and the synthesizer is saying tabs and
> spaces all over the place, so that's not good.
> what did i manage to break this time?
> 
> 
> 
> On 8/23/2011 4:53 PM, Tomtom wrote:
>> 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: 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. 
>> _______________________________________________ chuck-users mailing
>> list chuck-users at lists.cs.princeton.edu 
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iQEcBAEBAgAGBQJOVB0sAAoJEIaKvi7tbzRHB8UIAJCyWa2Qrt+Rl4PL0yTaBzpU
> IoZe/mIWYVx1xh6IIW4gFK4A4lH6OsNca1BAeYSiSSs74Buk7tHe15WDwZdsp3XA
> apYavet518Ck/KuKn3zBe0mPtSGvv/RVLlPZu9i1+BY2+E1y/pDBra9T8nLOliPV
> gLsJlBXIRHYHskFfF1IoQFqjXhOgqwtkBX7AIvLoaoDxbAJODepm5fkNf7imr+Lc
> CShhCilMAaykNM98S8RCLWAowuN23NNSjFkE3l4bIFZz+A2XA22fWZHuxwT1O8v2
> WMDZxZ6oLcAMCRo7PQKy4X6IoETbAjCjXBkn7I7aYWbRfh/9jVDxy71pQbhyfr8=
> =yMsn
> -----END PGP SIGNATURE-----
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users


More information about the chuck-users mailing list