Programming for Musicians and Digital Artists
Creating music with ChucK
Ajay Kapur, Perry Cook, Spencer Salazar, and Ge Wang
Foreword by Casey Reas
  • December 2014
  • ISBN 9781617291708
  • 344 pages
  • printed in black & white

A plethora of well-explained examples to help readers learn in a engaged, hands-on way.

From the Foreword by Casey Reas, UCLA

Programming for Musicians and Digital Artists: Creating Music with ChucK offers a complete introduction to programming in the open source music language ChucK. In it, you'll learn the basics of digital sound creation and manipulation while you discover the ChucK language. As you move example-by-example through this easy-to-follow book, you'll create meaningful and rewarding digital compositions and "instruments" that make sound and music in direct response to program logic, scores, gestures, and other systems connected via MIDI or the network.

Table of Contents show full




about this book

about the authors

Introduction: ChucK programming for artists

0.1. Why do musicians and artists need to program?

0.2. What is ChucK? How is it different?

0.3. Why program in ChucK?

0.4. ChucK-powered and pre-ChucK computer-mediated art

0.5. Summary

Part 1 Introduction to programming in ChucK

1. Basics: sound, waves, and ChucK programming

1.1. Sound waves and waveforms

1.2. Your first ChucK programs

1.2.1. Your first program: "Hello World"

1.2.2. Your first sound program: "Hello Sine!"

1.2.3. Now let’s make music

1.2.4. Trying new waveforms

1.3. Data types and variables

1.4. Time in ChucK: It’s about now

1.4.1. Variables of type dur

1.4.2. The importance of time

1.4.3. Variables of type time

1.4.4. Working with now

1.5. Logic and control structures for your compositions

1.5.1. Programming power through logic statements: the if statement

1.5.2. Logical operators and conditions

1.5.3. The for loop control structure

1.5.4. The while loop control structure

1.6. Using multiple oscillators in your music

1.7. A final example: "Twinkle" with oscillators, variables, logic, and control structures

1.8. Summary

2. Libraries: ChucK’s built-in tools

2.1. The Standard library: tools for pitch, loudness, and more

2.1.1. Deriving musical frequencies from MIDI note numbers

2.1.2. Converting between data types: float to int

2.1.3. Obtaining an int from a number expressed as text

2.2. The ChucK Math library

2.2.1. Math library random functions

2.2.2. Rounding numbers: being more fair about float-to-int conversion

2.3. Stereo and panning

2.4. Example: random music with two voices and panning

2.5. Summary

3. Arrays: arranging and accessing your compositional data

3.1. Declaring and storing data in arrays

3.2. Reading and modifying array data

3.3. Using array data to play a melody

3.4. Storing other types of data in arrays

3.4.1. Using an array to store durations

3.4.2. Arrays of strings: text can be musical too

3.5. Example: a song with melody, harmony, and lyrics!

3.6. Summary

4. Sound files and sound manipulation

4.1. Sampling: turning sound into numbers

4.2. SndBuf: loading and playing sound files in ChucK

4.2.1. Organizing your sound files

4.2.2. Looping (automatically repeating) your samples

4.2.3. Playing your samples backward

4.2.4. Managing multiple samples at a time

4.3. Stereo sound files and playback

4.4. Example: making a drum machine

4.4.1. Adding logic for different drums on different beats

4.4.2. Controlling when drums play using logic arrays

4.5. A new math/music tool: the modulo operator

4.6. Tying it all together: your coolest drum machine yet

4.7. Summary

5. Functions: making your own tools

5.1. Creating and using functions in your programs

5.1.1. Declaring functions

5.1.2. Your first musical function

5.1.3. Local vs. global variables

5.2. Some functions to compute gain and frequency

5.2.1. Making real music with functions

5.2.2. Using a function to gradually change sonic parameters

5.2.3. Granularize: an audio blender function for SndBuf

5.3. Functions to make compositional forms

5.3.1. Playing a scale with functions and global variables

5.3.2. Changing scale pitches by using a function on an array

5.3.3. Building a drum machine with functions and arrays

5.4. Recursion (functions that call themselves)

5.4.1. Computing factorial by recursion

5.4.2. Sonifying the recursive factorial function

5.4.3. Using recursion to make rhythmic structures

5.5. Example: making chords using functions

5.6. Summary

Part 2 Now it gets really interesting!

6. Unit generators: ChucK objects for sound synthesis and processing

6.1. ChucK’s special UGens: adc, dac, and blackhole

6.2. The pulse width oscillator: an electronic music classic

6.3. Envelope (smooth slow function) unit generators

6.3.1. Making a clarinet sound using SqrOsc and Envelope

6.3.2. Making a violin sound with SawOsc and the ADSR Envelope UG

6.4. Frequency modulation synthesis

6.5. Plucked string synthesis by physical modeling

6.5.1. The simplest plucked string

6.5.2. Exciting the plucked string with noise

6.5.3. Modeling frequency-dependent decay with a filter

6.5.4. Modeling fractional (tuning) delay and adding an ADSR for plucking

6.6. Intro to filter UGens: frequency-dependent gain

6.7. More on delays: room acoustics and reverberation

6.8. Delay-based audio effects

6.9. Example: fun with Filter and Delay UGens

6.10. Summary

7. Synthesis ToolKit instruments

7.1. STK wind instruments

7.1.1. The STK brass instrument physical model UGen

7.1.2. The STK Flute physical model UGen

7.2. Better stringed instruments

7.2.1. The STK Sitar physical model UGen

7.2.2. The STK Mandolin physical model UGen

7.2.3. The STK bowed string instrument UGen

7.3. Bars and other rigid things

7.4. Particle models

7.5. Synth soundz

7.6. Voices

7.7. Example: Indian music

7.8. Summary

8. Multithreading and concurrency: running many programs at once

8.1. Programming with concurrency

8.2. Shreds and sporking

8.3. A parallel, multithreaded, concurrent drum machine

8.4. Using concurrency to control aspects of common objects

8.5. Machine commands: adding ChucK files as new shreds

8.5.1. ChucK Machine commands for adding and running files

8.5.2. Using Machine functions for composition

8.6. Example: building a multithreaded jazz band

8.6.1. A file organization structure for your jazz band

8.6.2. Programming the individual players

8.6.3. An architecture for running your concurrent code

8.7. Summary

9. Objects and classes: making your own ChucK power tools

9.1. Object-oriented programming: objects and classes

9.1.1. Objects in general

9.1.2. Classes

9.2. Writing your own classes

9.3. Overloading: different functions can share the same name

9.4. Public vs. private classes

9.4.1. Useful applications for public classes

9.4.2. The Clear VM button

9.4.3. Static variables

9.5. an architecture for organizing your code

9.6. Conducting a drum pattern using a time-varying BPM

9.7. Making new classes from existing classes

9.7.1. Inheritance: modeling and modifying parents

9.7.2. Polymorphism: managing many children

9.8. Example: building a smart mandolin player

9.9. Summary

10. Events: signaling between shreds and syncing to the outside world

10.1. What are events?

10.2. Programming with events: keyboard input

10.3. Inter-shred communication using events

10.3.1. Using event.signal() to synchronize one shred to another

10.3.2. Using signal to synchronize multiple shreds

10.3.3. Triggering multiple shreds at the same time using events

10.4. Customized events example: a multi-instrument gamelan

10.5. Summary

11. Integrating with other systems via MIDI, OSC, serial, and more

11.1. Using MIDI: history, basics, and advanced applications

11.1.1. MIDI messages

11.1.2. External MIDI controllers for ChucK

11.1.3. ChucK to ChucK using a virtual MIDI port

11.1.4. Controlling robots via MIDI

11.2. Open Sound Control: networking music

11.3. Serial input/output to the outside world

11.4. Summary: looking outward and forward

Appendix A: Installing ChucK and miniAudicle

Appendix B: Library functions: Std, Math, other

B.1. The ChucK Standard Library

B.2. The ChucK Math library

B.3. Virtual machine commands and functions

B.4. Shred object functions

B.5. String object functions

B.6. Array object functions

Appendix C: Unit generators

C.1. Audio input and output UGens

C.2. Methods common to all unit generators

C.3. Gain and stereo/mono UGens

C.4. Basic sound waves and function generator UGens

C.5. Oscillator unit generators

C.6. Lookup table unit generators

C.7. LiSa: a live sampling unit generator

C.8. STK Envelope generators

C.9. STK delays, reverberators, and delay-based effects

C.10. Sound file unit generators

C.11. Synthesis ToolKit filters

C.12. Non-linear signal-processing UGens

C.13. STK instruments

C.14. Blit: band-limited oscillator family

Appendix D: Network communication with Open Sound Control

Appendix E: File I/O

E.1. File basics

E.1.1. Opening and writing files

E.1.2. Reading files

E.1.3. Options for opening files

E.1.4. Non-sequential file access

E.2. Standard output and error

Appendix F: Serial I/O

F.1. Serial I/O reading

F.1.1. Bytes, ints, floats, strings

F.2. Serial I/O writing

Appendix G: ChucK on the command line

G.1. Mac OS command-line basics

G.2. The command line on Windows

G.3. On-the-fly programming

G.4. ChucK command-line reference

G.4.1. Source ChucK files

G.4.2. Basic command-line ChucK options

G.4.3. Audio options

G.4.4. Network options

G.4.5. ChuGin options

G.4.6. Advanced options

Appendix H: Extending ChucK


About the book

A digital musician must manipulate sound precisely. ChucK is an audio-centric programming language that provides precise control over time, audio computation, and user interface elements like track pads and joysticks. Because it uses the vocabulary of sound, ChucK is easy to learn even for artists with little or no exposure to computer programming.

Programming for Musicians and Digital Artists offers a complete introduction to music programming. In it, you'll learn the basics of digital sound manipulation while you learn to program using ChucK. Example-by-example, you'll create meaningful digital compositions and "instruments" that respond to program logic, scores, gestures, and other systems connected via MIDI or the network. You'll also experience how ChucK enables the on-the-fly musical improvisation practiced by communities of "live music coders" around the world.

What's inside

  • Learn ChucK and digital music creation side-by-side
  • Invent new sounds, instruments, and modes of performance
  • Written by the creators of the ChucK language

About the authors

Perry Cook, Ajay Kapur, Spencer Salazar, and Ge Wang are pioneers in the area of teaching and programming digital music. Ge is the creator and chief architect of the ChucK language.

combo $44.99 pBook + eBook
eBook $35.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

This book and ChucK bring together music and programming for everyone.

Jim Matlock, IBM

A fantastic way to learn programming and music technology hand-in-hand!

David Sumberg, Apple Inc.

Teaches coders how to write music and musicians how to write code.

Patrick Regan, University of Illinois at Springfield