[chuck-users] A couple of questions

Johan Nilsson artbysnipers at hotmail.com
Mon Jan 14 02:45:10 EST 2008


Hi, I started using ChucK some weeks ago and must say it looks promising. It seems to be the language I have been waiting for: simple enough to be usable for musical application yet low level enough to provide enough control. I have stumbled across some questions though. 1) Here is an example of a simple synthesizer with two envelopes, one for gain and one for frequency. For the first one it is rather straight forward how to connect it using the chuck operator, but as for the frequency envelope: is there some better way to implement it? I get the feeling I make things a bit complicated and inefficient this way. It would feel more natural to me to chuck it to a frequency input of osc. public class Synth{ SawOsc osc => ADSR ampEnv => dac; ADSR freqEnv => blackhole; spork~frequencyEnvelope(); float freq;   fun void keyOn(float f) {  f => freq;  ampEnv.keyOn();  freqEnv.keyOn(); }  fun void keyOff() {  ampEnv.keyOff();  freqEnv.keyOff(); }
 fun void frequencyEnvelope() {  while(10::ms => now)  {   freqEnv.value() * 1000 + freq => osc.freq;  } }} 2) Suppose I want to rout the synth from the above example through a delay, this would feel like a natural way to do that:
Synth synth => Delay delay => dac;
Is it possible to define your own chuck operator for some class? To get around this I have added a Gain out to the synth which can be routed like this:
synth.out => delay => dac;
It works, but it is not too beautiful
 
3) I got the idea I wanted to kill a shread someting like this:
spork~theShred() => @ Shred handle; // this is exactly like the "sporking shreds" chapter in the lang spechandle.kill(); //this is pure imagination
 
3a) My first concern is that the first line doesn’t compile. The compiler gives “cannot resolve operator ‘=>’ on types ‘Shred’ and ‘Shred’… Am I supposed to use the @=> operator in this situation?3b) Is it possible to kill a shred by reference?
 
Thanks for a wonderful musical programming language, Johan Nilsson
_________________________________________________________________
Trött på krångliga mejladresser? Skaffa en live.se-adress här!
 http://get.live.com/mail/options
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080114/2f99bfb5/attachment.htm 


More information about the chuck-users mailing list