this aspect is great!!
i think i"ll do a lot of function things going on in the near future
ah!! i cannot help myself from becoming greedy but
if i have
SinOsc s1 => Gain g1 => dac;
somewhere(where?) related to the main while
could the s1.freq() be used for calculation in defining the function?
looking for a global something might be a better solution?
i have some sort of fake indian music structure in mind
making a note "sa" should have function "ri"~"ni" floating around them
sub-note "ri"~"ni" should own jointly "sa"'s freq
in that way
i think we can make music in a
.ck = harmony = melody = raga
way
blablabla
On 8/3/07, Kassen
On 8/3/07, Martin Ahnelöv
wrote: loops, but wanted them to run "side-by-side", but looping at different speeds, how would you do it?
Yes, you can do that. FYI, it's called threading in traditional programming languages and is often a pain in the ass, but since chuck isn't a traditional language it's called sporking and is as simple as running a chuck file.
That's right!
You can also do sporking in the code, but I haven't looked at that enough - it's in the help pages, though.
That's also quite simple. You can run threads (we call them shreds) next to the main one. You define those as functions and you "spork" the function. ======================================= //let's define a function fun void paralel() { while(true) { //this will loop forever <<<"beep">>>; second => now; } }
//let's try sporking it spork ~ paralel();
//now we write the main loop that will run next to it while(true) { //this will also loop forever <<<"boop">>>; .75::second => now; }
//anything that you would write here will never get executed because the program will always be stuck in that last loop. you could still define functions here though.
-----------------------------
See? not at all hard. You can run as many functions next to eachother as you like, they can all be different or they could all be the same. If they are all the same you only need to define it once and can spork it as many times as you'd like (untill the cpu gives up! Notice that they can all run at different speeds if you'd like, in my example above one loops in .75 seconds while the other takes a whole second so they will drift in and out of phase.
Cheers, Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users