Skip to content

ccrma/chuck

Repository files navigation

ChucK macOS - build & unit tests Linux - build & unit tests Windows - build & unit tests

Strongly-timed Music Programming Language

ChucK is a programming language for real-time sound synthesis and music creation. It is open-source and freely available on macOS, Windows, and Linux. ChucK presents a unique time-based, concurrent programming model that is precise and expressive (we call this strongly-timed), with dynamic control rates and the ability to add and modify code on-the-fly. In addition, ChucK supports MIDI, OpenSoundControl, HID devices, and multi-channel audio. It's fun and easy to learn, and offers composers, researchers, and performers a powerful programming tool for building and experimenting with complex audio synthesis/analysis programs, and real-time interactive music.

Welcome to ChucK!

Installing ChucK

To download and install ChucK, visit the official ChucK release page.

For more information, including documentation, examples, research publications, and community resources, visit the ChucK homepage or its Princeton mirror.

Homebrew

brew install chuck

Building ChucK

To build the latest ChucK from source, clone the chuck repo from GitHub:

git clone https://github.com/ccrma/chuck.git

macOS

navigate to the chuck/src directory, and run make:

cd chuck/src
make mac

OR to build a universal binary (intel + apple silicon):

make mac-ub

This should build a chuck executable in chuck/src.

Linux

Dependencies: gcc, g++, make, bison, flex, libsndfile, ALSA (for linux-alsa builds), PulseAudio (for linux-pulse builds), JACK (for linux-jack builds)

To set up a build environment for chuck on Debian or Ubuntu:

sudo apt install build-essential bison flex libsndfile1-dev \
  libasound2-dev libpulse-dev libjack-jackd2-dev

For other Linux distributions, the setup should be similar although the package install tools and package names may be slightly different. (NOTE: setups that do not need JACK or PulseAudio can omit either or both of these packages. ALSA is needed for MIDI support on Linux.)

To build chuck (with all supported drivers: ALSA, PulseAudio, JACK), navigate to the chuck/src directory and run make:

cd chuck/src
make linux-all

FYI make linux-all is equivalent in outcome to combining individual drivers:

make linux-alsa linux-pulse linux-jack

To build chuck for a subset of ALSA, PulseAudio, or JACK, run make with the desired driver(s). For example, to build for ALSA and PulseAudio only:

make linux-alsa linux-pulse

Or, to build for ALSA only:

make linux-alsa

This process should build a chuck executable in chuck/src.

Windows

To build chuck using Visual Studio (2019 or later recommended), navigate to chuck\src\visual-studio, open chuck.sln, and build.

Web

To compile ChucK to WebAssembly (WASM):

  • install the Emscripten SDK (and activate the SDK version, as instructed in the link)
  • before building, enable Emscripten paths and environment variables (e.g., from the emsdk directory):
source ./emsdk_env.sh
  • navigate to the chuck/src/ directory, and run make web:
cd chuck/src
make web

This should create webchuck.wasm and webchuck.js in the chuck/src/host-web/webchuck/js directory. (Also see: WebChucK)

Contributing to ChucK

Here are the source repositories maintained by the ChucK Team. Developers wanted!

chuck | core language, virtual machine, and synthesis engine

chugins | extend chuck with plugins! a great place to start contributing

miniAudicle | an IDE for chuck

webchuck | chuck running in web browsers (works on desktops and phones!)

webchuck IDE | a browser-based IDE for chuck

chunity | ChucK in Unity

chunreal | ChucK in Unreal Engine (new!)

chugl | ChucK Graphics Library (new!)

Integrating ChucK as Component in Other C++ Hosts

It is possible to incorporate ChucK core (compiler, virtual machine, synthesis engine) as a component/library within other c++ software hosts. This can be useful for adding ChucK functionalities to your software systems or to create new plugins. FYI the various tools listed in the previous section all incorporate ChucK in this core/host model: including command-line, miniAudicle, Unity, Unreal Engine, WebAssembly; additionally ChucK has been integrated with openFrameworks, iOS/Android apps, embedded systems, and in hybrid language systems, e.g., FaucK (FAUST + ChucK), ChucKDesigner (ChucK in TouchDesigner), chuck~ (ChucK in Pure Data), chuck~ (ChucK in Max/MSP).

To show how this integration can be done, we have created a series of examples in C++ to show how to integrate ChucK into any C++ host. The simplest of these examples, example-1-minimal.cpp, creates a minimal ChucK host in C++ in about 20 lines of code. The subsequent examples show adding real-time audio, C++/ChucK communication using ChucK globals, and ChucK shred control from C++, respectively. These host examples can be found in the src/host-examples/ folder of this repository. For more advanced usage, checkout the various tools in the ChucK ecosystem as listed above in the previous section. To get started building these host examples:

cd src/host-examples
make

Building ChucK Core in "Vanilla" Mode

It is also possible to build only ChucK core (compiler, virtual machine, and synthesis engine), without a host and without any platform-specific real-time audio I/O. This can be a helpful starting point for integrating ChucK core into existing host systems that already have audio I/O. To build ChucK core in "vanilla" mode:

cd src/core
make vanilla

License

ChucK source code is dual-licensed under the MIT License and the GNU General Public License 2.0 (or any later version). You can choose either license if you use this work.

ChucK History

ChucK was created in the early 2000s at Princeton University by Ge Wang and Perry R. Cook, while Ge was a Ph.D. student advised by Perry in the Computer Science Department. The first version of ChucK was released under a GPL license in 2003. Many researchers, teachers, and artists have contributed to ChucK's evolution over the years. Spencer Salazar created miniAudicle, a GUI-based integrated development environment for ChucK in 2004 (this IDE, in addition to the command line version of ChucK, remains largely how ChucK is distributed and used today). The Princeton Laptop Orchestra (PLOrk), founded by Dan Trueman and Perry Cook in 2005, began using ChucK for teaching as well as instrument and sound design. In 2006, Rebecca Fiebrink and Ge Wang created ChucK's audio analysis framework, expressed through unit analyzers--the analysis counterpart to unit generators. Ge join the faculty at Stanford University's CCRMA in 2007, and ChucK research and development became distributed, with developers at Princeton, Stanford, and elsewhere. The Stanford Laptop Orchestra (SLOrk) was founded in 2008 at CCRMA, where ChucK continued to be a tool for instrument design and teaching. In that same year, the mobile music startup Smule was co-founded, which used ChucK on the iPhone (codenamed "ChiP") as a real-time audio engine for its early apps: Ocarina, Sonic Lighter, Zephyr, and Leaf Trombone: World Stage. Meanwhile, ChucK continued to find its way into computer music curricula, including at Stanford, Princeton, CalArts. In 2015, the book Programming for Musicians and Digital Artists: Creating music with ChucK was published, authored by Ajay Kapur, Perry Cook, Spencer Salazar, and Ge Wang. Around the same time, Kadenze introduced the online course Introduction to Real-Time Audio Programming in ChucK. Romain Michon and Ge Wang integrated FAUST and ChucK to create FaucK. In 2017, Jack Atherton created Chunity, which enables one to program ChucK inside the Unity game development framework. In 2018, Ge wrote about ChucK in Artful Design: Technology in Search of the Sublime, a photocomic book about the importance of cultural awareness in the shaping of technology. ChucK now runs natively in web browsers (WebChucK) and can be programmed directly in the WebChucK IDE.

ChucK has been extensively documented in published articles and books (see list). For an overview, check out:

ChucK: A Strongly-Timed Music Programming Language“ comic book excerpt from Artful Design: Technology in Search of the Sublime

Wang, G., P. R., Cook, and S. Salazar. 2015. "ChucK: A Strongly Timed Computer Music Language" Computer Music Journal 39:4. doi:10.1162/COMJ_a_00324

ChucK Media

Non-source code documents (papers, logos, soundbites, comics) have been migrated to the chuck-media repository.

ChucK Community

Join us! ChucK Community Discord | ChucK-users Mailing list

Happy ChucKing!