ArticleslgStudy

computer science

ChucK

ChucK is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand ChucK rather than just read about it. In short: ChucK is a concurrent, strongly timed audio programming language for real-time synthesis, composition, and performance, which runs on Linux, Mac OS X, Microsoft Windows, and iOS. It is designed to favor readability and flexibility for the programmer over other considerations such as raw performance.

ChucK — main illustration
ChucK — illustration

Key takeaways

  • ChucK belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect ChucK to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of ChucK from memory before moving on to harder problems.

Reference excerpt

ChucK is a concurrent, strongly timed audio programming language for real-time synthesis, composition, and performance, which runs on Linux, Mac OS X, Microsoft Windows, and iOS. It is designed to favor readability and flexibility for the programmer over other considerations such as raw performance. It natively supports deterministic concurrency and multiple, simultaneous, dynamic control rates. Another key feature is the ability to live code; adding, removing, and modifying code on the fly, while the program is running, without stopping or restarting. It has a highly precise timing/concurrency model, allowing for arbitrarily fine granularity. It offers composers and researchers a powerful and flexible programming tool for building and experimenting with complex audio synthesis programs, and real-time interactive control. ChucK was created and chiefly designed by Ge Wang as a graduate student working with Perry R. Cook. ChucK is distributed freely under the terms of the GNU General Public License on Mac OS X, Linux and Microsoft Windows. On iPhone and iPad, ChiP (ChucK for iPhone) is distributed under a limited, closed source license, and is not currently licensed to the public. However, the core team has stated that it would like to explore "ways to open ChiP by creating a beneficial environment for everyone".

Language features The ChucK programming language is a loosely C-like object-oriented language, with strong static typing. ChucK is distinguished by the following characteristics:

Direct support for real-time audio synthesis A powerful and simple concurrent programming model A unified timing mechanism for multi-rate event and control processing. A language syntax that encourages left-to-right syntax and semantics within program statements. Precision timing: a strongly timed sample-synchronous timing model. Programs are dynamically compiled to ChucK virtual machine bytecode. A runtime environment that supports on-the-fly programming. The ChucK Operator (=>) that can be used in several ways to "chuck" any ordered flow of data from left to right. ChucK standard libraries provide:

MIDI input and output. Open Sound Control support. HID connectivity. Unit generators (UGens) - ie oscillators, envelopes, synthesis toolkit ugens, filters, etc. Unit analyzers (UAnae) - blocks that perform analysis functions on audio signals and/or metadata input, and produce metadata analysis results as output - ie FFT/IFFT, Spectral Flux/Centroid, RMS, etc. Serial IO capabilities - ie Arduino. File IO capabilities.

Code example The following is a simple ChucK program that generates sound and music:

// signal graph (patch) SinOsc s => JCRev r => dac; .2 => s.gain; // dry/wet mix (for reverb) .1 => r.mix; // an array of pitch classes (semitones) [ 0, 2, 4, 7, 9, 11 ] @=> int hi[]; // do forever: while( true ) { // choose a note, shift registers, convert to frequency Std.mtof( 45 + Std.rand2(0,3) * 12 + hi[Std.rand2(0,hi.cap()-1)] ) => s.freq; // advance time 120::ms => now; }

Uses ChucK has been used in performances by the Princeton Laptop Orchestra (PLOrk) and for developing Smule applications, including their ocarina emulator. PLOrk organizers attribute some of the uniqueness of their performances to the live coding they can perform with ChucK.

See also

Comparison of audio synthesis environments Sonic Pi Pure Data

References

Further reading

External links ChucK homepage at Princeton University ChucK mirror at Stanford University ChucK FLOSS manual

Illustrations

ChucK illustration

Worked examples

Example 1 — a first encounter with ChucK

Start with the simplest possible case. Write down what ChucK claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to ChucK before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about ChucK ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of ChucK

In research
ChucK appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses ChucK in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
ChucK is common in secondary-school and first-year university syllabi. It links to neighbouring topics Audio programming languages, Audio software with JACK support, Cross-platform software, so understanding it makes those chapters shorter.
In everyday life
Look for ChucK outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “ChucK” →

How to study ChucK in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what ChucK means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain ChucK out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is ChucK in simple terms?

ChucK is a concurrent, strongly timed audio programming language for real-time synthesis, composition, and performance, which runs on Linux, Mac OS X, Microsoft Windows, and iOS. It is designed to favor readability and flexibility for the programmer over other considerations such as raw performance.

Why does ChucK matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study ChucK?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on ChucK.

Tags

  • Audio programming languages
  • Audio software with JACK support
  • Cross-platform software
  • Electronic music software
  • Free audio software
  • Live coding
  • Software synthesizers
  • Synchronous programming languages

Keep exploring