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 | |
|---|---|
| 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 | |
|---|---|
| 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 | |
|---|---|
| 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 | |
|---|---|
| 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 |
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 |
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 & Objects | |
|---|---|
| Dinky instrument implemented as class | dinky.ck |
| a file that uses the class Dinky | try.ck |
| Extend | |
|---|---|
| chugraph | chugraph.ck |
| chugraph2 | chugraph2.ck |
| chugraph2a | chugraph2a.ck |
| chugen (rhymes with 'ugen') | chugen.ck |
| chugin (rhymes with 'plugin') |
| 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 |
| 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 |
| 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 |
| 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 |
| Events/OSC (Open Sound Control) | |
|---|---|
| OSC message event demo (run in parallel) | s.ck (sender), r.ck (receiver) |
| OSC dump | osc-dump.ck |
| 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 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 |
| 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 operations | strops.ck, strops2.ck |
| String escape sequences | escape.ck |
| String input + tokenize (hacked; temporary) | readline.ck, token.ck |
| 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 |
| 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 |
| 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 |
|---|
| 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 |
|---|
| 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 |
| 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 |
|---|
| Listing9.20.ck |
| Listing9.21.ck |
| Listing9.22.ck |
| MandoPlayer.ck |
| MandoScore.ck |
| initialize.ck |
| chapter10 |
|---|
| Listing10.1.ck |
| Listing10.2.ck |
| Listing10.3.ck |
| Listing10.4.ck |
| Listing10.4b.ck |
| Listing10.4c.ck |
| Listing10.5.ck |
| chapter11 |
|---|
| Listing11.1.ck |
| Listing11.1Twinkle.ck |
| Listing11.2.ck |
| Listing11.3.ck |
| Listing11.4.ck |
| Listing11.5.ck |