Chuck Examples
The following are example programs that demonstrate basic language features, tools, and techniques. All of these examples files can be found in the distribution (download page)
under the folder examples. Additionally, they can be accessed from within miniAudicle, under "File> Open Example..." Many of these examples are also linked from
the ChucK API Reference. Good luck and have fun!
Various Basic Examples
A selection of examples that demonstrate basic sound generation, timing, and control in ChucK. As with all examples here, feel free to try and experiment!
variable assignment and use
chucking & unchucking ugens
modulating ugen parameters
using command line arguments
a chuckian alarm clock (no warranties!)
simple comb filter using Delay
knuckleheads (time shifted phase locking)
knuckleheads++ (with glottal voicing)
sinosc + blit (bandlimited oscillators)
FM synthesis with two sinosc
FM (actual frequency modulation)
mic input and simple comb filter
basic ring-mod (demonstrate ugen input)
sndbuf (file read/write/playback)
sndbuf.valueat() - random access samples
math.isinf() also math.isnan()
input/output (including FileIO) examples
formant-based singing synthesis
audio dithering "by hand"
one pole envelope follower
karplus strong plucked string
plucked string with mandolin body excitation
tuned plucked string (a la jaffe/smith)
karplus strong comb-filter bank chugraph
say "ChucK" through synthesis
Super Mario Bros. theme, recreated in ChucK
THX Deep Note emulator (
info)
Reich's Clapping Music using glottal pulses
variations on towers of hanoi sonification
on-the-fly synchronization (concurrent)
Can't decide? Flip a coin with maybe!
Okay, not that fun, but really useful
Language Features
These examples demonstrate features described in the ChucK Language Specification.
Survey of chuck's primitive types
Working with the Type type
Querying active types in the VM
Using vec3 as a slewing interpolator
store and retrieve values
for-each in array (with auto type)
arrays are automatically resized
(e.g., using append and popBack)
erasing elements in an array
instantiating multidimensional arrays
array as function argument
multi-dimensional array instantiation
mixed associative and linear array
generating arrays containing ranges of values
negative indexing of arrays
zeroing the elements an array
continue w/ nested blocks
objects as function arguments
Machine.add() .remove() .replace()
Virtual Machine functions
evaluating string as code
VM operations hodge-podge
Tools and Techniques
These examples demonstrate pratical tools ranging from unit generators, events, mouse / keyboard / joystick input, file I/O, MIDI, Open Sound Control, how to extend ChucK unit generators, and more.
Dinky instrument implemented as class
class constructors and destructor
learning about objects with .help()
a file that used the class Dinky
a more extensive example