ChucK : Examples

The following are sample files which demonstrate basic language features, in addition to the new functionality introduced in chuck-v2. All of these samples files can be found in the distribution (download page) under the folder examples - in either the source download or the executable download.

Examples listed together are variations on a theme, or are intended to be run in parallel, like this:

% chuck moe.ck larry.ck curly.ck

or perhaps:

% chuck otf*.ck

Basic Demonstrations

Basic Demonstrations
time and duration demo0.ck
variable assignment and use demo1.ck
chucking & unchucking ugens demo2.ck
modulating ugen parameters demo3.ck
using command line arguments args.ck
mic input adc.ck
ADSR method adsr.ck
a chuckian alarm clock (no warranties!) alarm.ck
digital delay delay.ck
simple comb filter using Delay comb.ck
echo effect echo.ck
using Envelope envelope.ck
knuckleheads (time shifted phase locking) larry.ck, curly.ck, moe.ck
knuckleheads++ (with glottal voicing) larry++.ck, curly++.ck, moe++.ck
function demo func.ck
po-tweet! chirp.ck, chirp2.ck
the uh, whole tone scale whole.ck
sinosc + blit (bandlimited oscillators) foo.ck, foo2.ck, blit.ck, blit2.ck
FM synthesis "by hand" fm.ck
FM synthesis with two sinosc fm2.ck
FM (actual frequency modulation) fm3.ck
oscillators osillatronx
mic input and simple comb filter i-robot.ck
impulse generator imp.ck
low-frequency oscillator lfo
recording (via WvOut) rec.ck, rec-auto.ck, rec-auto-stereo.ck
clocks (useful when recording and other) tick.ck, tick2.ck
basic ring-mod (demonstrate ugen input) ring.ck
sndbuf (file read/write/playback) sndbuf.ck
sndbuf.valueat() - random access samples valueat.ck
step ugen step.ck
unchuck unchuck.ck
whirl whirl.ck
noise & filters wind.ck, wind2.ck
function test zerox.ck
math.isinf() also math.isnan() infnan.ck
help - built-in help help.ck

Deep Stuff

Deep Stuff
formant-based singing synthesis chant.ck
audio dithering "by hand" dither.ck
how phones dial dtmf.ck
one pole envelope follower follower.ck
karplus strong plucked string plu.ck
plucked string with mandolin body excitation plu2.ck
tuned plucked string (a la jaffe/smith) plu3.ck
say "ChucK" through synthesis say-chu.ck
Continuous shepard-risset tone generator shepard.ck
THX Deep Note emulator thx.ck
Reich's Clapping Music using glottal pulses unclap.ck

More Fun Experiments

More Fun Experiments
variations on towers of hanoi sonification hanoi.ck, hanoi++.ck, hanoi2.ck, hanoi3.ck
on-the-fly synchronization (concurrent) otf_01.ck, otf_02.ck, otf_03.ck, otf_04.ck, otf_05.ck, otf_06.ck, otf_07.ck

Special

Special
Dynamics Dyno-compress.sk, Dyno-duck.ck, Dyno-limit.ck
GenX readme-GenX.ck, Gen10-test.sk, Gen17-test.sk, Gen5-test.sk, Gen7-test.sk, Gen9-test.sk
CurveTable GenX-CurveTable-test.ck
WarpTable GenX-WarpTable-test.ck

Language Features

These files demonstrate and/or test the features described in each section of the ChucK Language Specification.

Types
survey of chuck's primitive types type_primitives.ck
Object type type_object.ck
Analysis types (polar, complex) type_analysis.ck
Vectors 3D + 4D vec3.ck, vec4.ck
Using vec3 as a slewing interpolator interpolate.ck
Arrays
store and retrieve values array_storage.ck
array @=> assignment array_assign.ck
instantiating multidimensional arrays array_mdim.ck
reassigning sub-arrays array_sub_assign.ck
array as function argument array_argument.ck
mixed associative and linear array array_mmixed.ck
array resizing array_resize.ck
dynamically sized array array_dynamic.ck
Operators
operators for assignment oper_assign.ck
logical operators oper_logic.ck
pre/post increment oper_pre_inc.ck, oper_post_inc.ck
arithmetic operators oper_arith_chuck.ck
Time & Timing
time and duration time_types.ck
reasoning about time time_operations.ck
Control Structures
for loop ctrl_for_loop.ck
until ctrl_until.ck
do-until ctrl_do_until.ck
break ctrl_break.ck
break w/ nesting ctrl_break_nested.ck
continue w/ nested blocks ctrl_continue.ck
Philip's sequencer ctrl_sequencer.ck
Functions
function overloading func_overload.ck, func_overload_member.ck, func_overload_multi.ck, func_doozey.ck
recursive functions func_recursion.ck
objects as function arguments func_obj_arg.ck
chucking to void function func_void.ck
Shreds & Concurrency
sporking shreds spork.ck, spork2.ck
sporking many shreds powerup.ck
machine.add() .remove() .replace() machine.ck
machine.dir() dir.ck

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.

Classes and Objects

Classes & Objects
Dinky instrument implemented as class dinky.ck
a file that uses the class Dinky try.ck

Extending ChucK Unit Generators

Extend
chugraph chugraph.ck
chugraph2 chugraph2.ck
chugraph2a chugraph2a.ck
chugen (rhymes with 'ugen') chugen.ck
chugin (rhymes with 'plugin')

Events

Events
event broadcast method broadcast.ck
event signal method signal.ck, signal4.ck
extending events (creating custom events) event_extend.ck
typing-based instrument clix.ck, clix2.ck, clix3.ck
more keyboard events kb.ck, kb2.ck

Input/Output

I/O examples
stdout (chout) chout.ck
read-int read-int.ck
read-line read-line.ck
read-str read-str.ck
write write.ck
write2 write.ck

HID Input (Joystick, Mouse, Keyboard)

Events/HID (Human Interface Devices)
Joystick demo joy.ck, joy-fm.ck, joy-noise.ck, joy-shake.ck
Mouse demo mouse-fm.ck
Keyboard demo kb.ck, keyboard-organ.ck, kb2.ck
Tilt demo tilt.ck

MIDI

Events/MIDI
MIDI event demo gomidi.ck, gomidi2.ck
MIDI polyphony polyfony.ck, polyfony2.ck
MIDI file demo midifile-play.ck
MIDI out midiout.ck

Open Sound Control (OSC)

Events/OSC (Open Sound Control)
OSC message event demo (run in parallel) s.ck (sender), r.ck (receiver)
OSC dump osc-dump.ck

Serial I/O

Serial examples
reading bytes byte.ck, bytes.ck
reading ascii/binary ints.ck, ints-ascii.ck, ints-bin.ck
lines lines.ck
writing write.ck, write-bytes.ck
listing serial devices list.ck
arduino ckserial.ino

Stereo / Multi-channel

Stereo examples
Stereo noise (using Pan2) stereo-noise.ck
Stereo powerup powerup2.ck
Stereo => arrays of mono UGens ugen-array.ck
Stereo Stooges curly2.ck, larry2.ck, moe2.ck
Multi-channel demos n-chan(i), n-chan(n), we-robot.ck

Live Sampling and Granular Synthesis Using LiSa

LiSA
Basics of live sampling using LiSA readme-Lisa1.ck, readme-Lisa2.ck
Live sampling simple looping Lisa-simplelooping.ck
Granular sampling examples LiSa-munger1.ck, LiSa-munger1.ck, LiSa-munger1.ck
Granular synthesis examples from Twilight (2013) twilight-granular-kb.ck, twilight-granular-kb-interp.ck
Loading an audio file into a LiSa Lisa-load.ck
LiSa tracking mode examples LiSa-track1, LiSa-track2, LiSa-track3, LiSa-track4, LiSa-track5
Input-driven LiSa trigger LiSa-trigger.ck

String Utilities

String Utilities
String operations strops.ck, strops2.ck
String escape sequences escape.ck
String input + tokenize (hacked; temporary) readline.ck, token.ck

Unit Generators

STK (Synthesis ToolKit) demos
BandedWG (Banded Waveguide) bandedwg.ck, band-o-matic.ck
BlowBotl blowbotl.ck, blowbotl2.ck
BlowHole blowhole.ck
Bowed bowed.ck
Brass brass.ck
Clarinet clarinet.ck
Flute flute.ck
French Horn frenchhrn-algo2.ck
HevyMetl hevymetl-acoustic-algo3, hevymetl-algo3.ck, hevymetl-trumpet-algo3.ck, hevymetl-dance-now
HonkeyTonk honkeytonk-algo1.ck
Krystal Choir krstlchr-algo7.ck
ModalBar modalbar.ck, mode-o-test.ck, mode-o-matic.ck
Moog (r.i.p. bob) moog.ck, moogie.ck
Rhodey (Rhodes synth) rhodey.ck
Saxofony saxofony.ck
Shakers shake-o-matic.ck
Sitar sitar.ck
StifKarp stifkarp.ck, stif-o-karp.ck
VoicForm voic-o-form.ck
Wurley (Wurlitzer model) wurley.ck, wurley2.ck, wurley3.ck

Unit Analyzers

Transformations
Finding the pitch of a note autocorr.ck
Silliness with FeatureCollector concat.ck
FFT fft.ck, fft2.ck, fft3.ck
IFFT ifft.ck, ifft2.ck, ifft3.ck
DCT dct.ck
Windowing win.ck
(really bad) spectral cross-synthesis xsynth.ck
calculate signal delay xcorr.ck
Feature Extractors
Centroid centroid.ck
Flux flux.ck, flux0.ck
RMS rms.ck
RollOff rolloff.ck, rolloff2.ck
Zero Crossing zerox.ck
Tracking
harmonize (with Tracking and Smacking) harm.ck
rough pitch tracking pitch-track.ck
rough pitch tracking + major third pitch-third.ck
rough pitch tracking + perfect fifth pitch-fifth.ck
rough pitch tracking + dominant seventh pitch-fifth.ck
Smacking - track 'smack' events Smacking.ck
Tracking - track peak amplitude via FFT Tracking.ck

Programming for Musicians and Digital Artists: Creating music with ChucK

chapter1

chapter1
Listing1.1.ck
Listing1.2.ck
Listing1.3.ck
Listing1.4.ck
Listing1.5.ck
Listing1.6.ck
Listing1.7.ck
Listing1.8.ck
Listing1.9.ck
Listing1.10.ck
Listing1.11.ck
Listing1.12.ck
Listing1.13.ck
Listing1.14.ck
Listing1.15.ck
Listing1.16.ck
Listing1.17.ck
Listing1.18.ck
Listing1.19.ck
Listing1.20.ck
Listing1.7Shorthand.ck
WowExample.ck

chapter2

chapter2
Listing2.1.ck
Listing2.2.ck
Listing2.3.ck
Listing2.4.ck
Listing2.5.ck
Listing2.6.ck
Listing2.7.ck
Listing2.8.ck

chapter3

chapter3
Listing3.1.ck
Listing3.2.ck
Listing3.3.ck
Listing3.4.ck
Listing3.5.ck
Listing3.6.ck
Listing3.7.ck
Listing3.8.ck

chapter4

chapter4
Listing4.1.ck
Listing4.2.ck
Listing4.3.ck
Listing4.4.ck
Listing4.5.ck
Listing4.6.ck
Listing4.7.ck
Listing4.8.ck
Listing4.9.ck
Listing4.10.ck
Listing4.11.ck
Listing4.12.ck

chapter5

chapter5
Listing5.1.ck
Listing5.2.ck
Listing5.3.ck
Listing5.4.ck
Listing5.5.ck
Listing5.6.ck
Listing5.7.ck
Listing5.8.ck
Listing5.9.ck
Listing5.10.ck
Listing5.11.ck
Listing5.12.ck
Listing5.13.ck
Listing5.14.ck
Listing5.15.ck
Listing5.16.ck
Listing5.17.ck
Listing5.18.ck
Listing5.19.ck
Listing5.20.ck

chapter6

chapter6
Listing6.1.ck
Listing6.2.ck
Listing6.3.ck
Listing6.4.ck
Listing6.5.ck
Listing6.6.ck
Listing6.7.ck
Listing6.8.ck
Listing6.9.ck
Listing6.10.ck
Listing6.11.ck
Listing6.12.ck
Listing6.13.ck
Listing6.14.ck
Listing6.15.ck

chapter7

chapter7
Listing7.1.ck
Listing7.2.ck
Listing7.3.ck
Listing7.4.ck
Listing7.5.ck
Listing7.6.ck
Listing7.7.ck
Listing7.8.ck
Listing7.9.ck
Listing7.10.ck
Listing7.11.ck
Listing7.12.ck
Listing7.13.ck
Listing7.14.ck
Listing7.15.ck
Listing7.16.ck
Listing7.17.ck
Listing7.18.ck
TryThis.ck

chapter8

chapter8
Listing8.1.ck
Listing8.2.ck
Listing8.3.ck
Listing8.4.ck
Listing8.5.ck
Listing8.6.ck
Listing8.7.ck
Listing8.8.ck
Listing8.9.ck
Listing8.10.ck
bass.ck
drums.ck
flute.ck
initialize.ck
piano.ck
score.ck

chapter9

chapter9
BPM.ck
Listing9.1.ck
Listing9.2.ck
Listing9.3.ck
Listing9.4.ck
Listing9.5.ck
Listing9.6.ck
Listing9.7.ck
Listing9.8.ck
Listing9.9.ck
Listing9.10.ck
Listing9.18.ck
Listing9.19.ck
MyScore.ck
UseBPM.ck
UseBPM2.ck
UseBPM3.ck
initialize.ck

Drum Machine

Drum Machine
BPM.ck
Listing9.11.ck
Listing9.12.ck
Listing9.13.ck
Listing9.14.ck
Listing9.15.ck
Listing9.16.ck
Listing9.17.ck
clap.ck
cowbell.ck
hihat.ck
initialize.ck
kick.ck
score.ck
snare.ck

Smart Mandolin

Smart Mandolin
Listing9.20.ck
Listing9.21.ck
Listing9.22.ck
MandoPlayer.ck
MandoScore.ck
initialize.ck

chapter10

chapter10
Listing10.1.ck
Listing10.2.ck
Listing10.3.ck
Listing10.4.ck
Listing10.4b.ck
Listing10.4c.ck
Listing10.5.ck

chapter11

chapter11
Listing11.1.ck
Listing11.1Twinkle.ck
Listing11.2.ck
Listing11.3.ck
Listing11.4.ck
Listing11.5.ck
home .. language .. program .. examples