Lab 1: Introduction to ChucK

Getting Started With ChucK

Useful Resources

Making a Simple "Orchestra"

SinOsc s => dac;

440 => s.freq;
0.5 => s.gain;

while(true){
  10::ms => now;
}
while(true){
  Math.random2f(100,1000) => s.freq;
  100::ms => now;
}
SawOsc s => JCRev r => dac;

440 => s.freq;
0.5 => s.gain;
0.05 => r.mix;
fun void albert(){
  SawOsc s => JCRev r => dac;

  440 => s.freq;
  0.5 => s.gain;
  0.05 => r.mix;

  while(true){
    Math.random2f(70,300) => s.freq;
    500::ms => now;
  }
}

fun void maureen(){
  TriOsc s => JCRev r => dac;

  440 => s.freq;
  0.5 => s.gain;
  0.05 => r.mix;

  while(true){
    Math.random2f(200,1500) => s.freq;
    250::ms => now;
  }
}

spork ~ albert();
2::second => now;
spork ~ maureen();

while(true){
  1::second => now;
}
fun void alex(){
  Noise n => BPF f => dac;

  5 => n.gain;
  30 => f.Q;

  while(true){
    Math.random2f(500,3000) => f.freq;
    125::ms => now;
  }
}
JCRev r => dac;
0.05 => r.mix;

fun void albert(){
  SawOsc s => r;

  440 => s.freq;
  0.5 => s.gain;

  while(true){
    Math.random2f(70,300) => s.freq;
    500::ms => now;
  }
}

fun void maureen(){
  TriOsc s => r;

  440 => s.freq;
  0.5 => s.gain;

  while(true){
    Math.random2f(200,1500) => s.freq;
    250::ms => now;
  }
}

fun void alex(){
  Noise n => BPF f => r;

  5 => n.gain;
  30 => f.Q;

  while(true){
    Math.random2f(500,3000) => f.freq;
    125::ms => now;
  }
}

<<< "Albert begins" >>>;
spork ~ albert();
2::second => now;
<<< "Maureen begins" >>>;
spork ~ maureen();
2::second => now;
<<< "Alex begins" >>>;
spork ~ alex();

while(true){
  1::second => now;
}

More Basic ChucK Examples

Assignment (Due on Jan. 18. 2018)