The Code of Music is a creative coder’s interactive guide to designing musical systems in the browser.
Organized around the elements of music —rhythm, melody, timbre, and harmony— it invites readers to explore how music works by listening, experimenting, and building. Interactive illustrations make musical concepts audible and visible; editable code examples, exercises, and inspiration projects help readers turn their discoveries into instruments and compositions of their own. Projects range from audiovisual instruments and interactive remixes to generative drum machines and melody generators.
The book is intended for readers with introductory coding experience. It assumes no prior knowledge of music theory, production, or computer music, and welcomes readers with a wide range of musical backgrounds and interests.
The Code of Music grew out of a class of the same name taught at NYU Tisch’s ITP/IMA, at the graduate and undergraduate levels, in New York City and Shanghai. The project has received support from NYU Tisch through Dean’s Faculty Research Grants and from the Processing Foundation through Google Summer of Code.
Explore a sample chapter and sign up to hear when new chapters are published.
Credits: The publishing system was developed by Jason Gao, building on an earlier version by Elias Jarzombek. The graphic design is by Proud Aiemruksa, with earlier design contributions from Martín Azambuja and Anh Lê. An exploratory AR prototype was developed by Stuti Mohgaonkar, with design by Rashree Saraf.
Copyright © 2026 Luisa Pereira. All rights reserved. Third-party media: Brief audio and visual excerpts are used for educational purposes and are believed to constitute fair use under U.S. law. Other media are used under their respective licenses.