Professional Documents
Culture Documents
Codes For Exhbition
Codes For Exhbition
ChucK is a multimedia programming language for real-time sound synthesis and music creation. It is
open-source and presents a unique time-based, concurrent programming model that is precise and
expressive (we call this strongly-timed), dynamic control rates, and the ability to add and modify code
on-the-fly. It is fun and easy to learn, and it offers us composers, researchers, and performers a powerful
tool for building and experimenting with complex audio synthesis/analysis programs, as well as real-time
interactive music.
At the root of every ChucK code are comments, debug print, and reserved words.
Comments are sections of code that are ignored by the compiler - they help other programmers, ourselves
included, interpret our code. Double slashes indicate to the compiler to skip the rest of the line. /* and */
denote block commenting - the compiler ignores the text in between.
// this is a comment
int foo; // another comment
/*
this is a block comment
still going...
*/
Debug print constructions may be placed around any non-declaration expressions (non-l-value) and will
not affect the execution of the code. Expressions which represent an object will print the value of that
object’s reference address:
// assign 5 to a newly declared variable
5 => int i;
// prints "5 : (int)"
<<<i>>>;
Reserved Words:
● (primitive types)
○ int
○ float
○ time
○ dur
○ void
○ same (unimplemented)
● (control structures)
○ if
○ else
○ while
○ until
○ for
○ repeat
○ break
○ continue
○ return
○ switch (unimplemented)
● (class keywords)
○ class
○ extends
○ public
○ static
○ pure
○ this
○ super (unimplemented)
○ interface (unimplemented)
○ implements (unimplemented)
○ protected (unimplemented)
○ private (unimplemented)
● (special values)
○ now
○ true
○ false
○ maybe
○ null
○ NULL
○ me
○ pi
Every ChucK code, no matter its intricacy, is compiled into virtual instructions which are immediately run
into what is called the ChucK Virtual Machine.
1.) stuffola.ck
// name: stuffola.ck
// composer: sarah gorbatov
// date: winter 2019
ow =
SinOsc r > d ac;
SinOsc c ol = > d ac;
// frequencies
[1209.0, 1336.0, 1477.0] @=> f loat cols[];
[697.0, 770.0, 852.0, 941.0] @ => float rows[];
// go!
while (i < 7) {
.5 => row.gain;
.5 => col.gain;
Math.random2(0,3) => r ;
Math.random2(0,2) => c ;
1 + r * 3 + c => n;
// patch
SinOsc s => JCRev g => dac;
.5 => g.gain;
.075 => g.mix;
// note number
20 => float note;
// go up to 127
while( note < 128 )
{
// convert MIDI note to hz
Std.mtof( note ) => s.freq;
// turn down the volume gradually
.5 - (note/256.0) => s.gain;
// turn off s
0 => s.gain;
// wait a bit
2::second => now;
// feedforward
Noise imp => OneZero lowpass => dac;
// feedback
lowpass => Delay delay => lowpass;
// our radius
.99999 => float R;
// our delay order
500 => float L;
// set delay
L::samp => delay.delay;
// set dissipation factor
Math.pow( R, L ) => delay.gain;
// place zero
-1 => lowpass.zero;
// fire excitation
1 => imp.gain;
// for one delay round trip
L::samp => now;
// cease fire
0 => imp.gain;
// advance time
(Math.log(.0001) / Math.log(R))::samp => now;
2.) echo.ck
// feedforward
adc => Gain g => dac;
// feedback
g => Gain feedback => DelayL delay => g;
***For more information about ChucK, contact either me or our programming instructor at
gorbatovsarah@gmail.com / aryeh.laufer@theideaschool.org***