TechnologyLive coding music tool

Sonic Pi

Free code-based music creation and performance tool that teaches programming by letting users write code that plays music instantly.

Sonic Pi is a free, code-based music creation and performance tool designed to teach programming through sound. Users write short programs in a simple language based on Ruby, such as commands to play notes, trigger samples or loop rhythms, and hear the results as soon as the code runs. Code can be changed while music is playing, making Sonic Pi suitable for live coding performance as well as classroom lessons. It runs on Raspberry Pi computers and on Windows, macOS and Linux.

Sam Aaron created Sonic Pi around 2012 at the University of Cambridge Computer Laboratory, initially in partnership with the Raspberry Pi Foundation to support the teaching of computing in schools. Its interface pairs a code editor with built-in tutorials, examples and a log of what is playing. Under the hood, it sends instructions to the SuperCollider synthesis server, which generates the audio. Features such as live loops and synchronization commands let several musical parts run at once, which also introduces students to ideas such as concurrency and timing.

Sonic Pi links two traditionally separate subjects, music and programming, and has been used in classrooms, workshops and club performances; Aaron and others have performed with it at algorave events, where audiences dance to music coded live. Because results are audible immediately, students can experiment and debug by ear. The software is released under the MIT License, and its approach has influenced the wider culture of accessible creative coding. For larger compositions, users often record their output and continue work in a digital audio workstation.

Key points

  • Sonic Pi teaches programming by letting users write code that makes music immediately.
  • Sam Aaron created it at the University of Cambridge with support from the Raspberry Pi Foundation.
  • It uses the SuperCollider synthesis server to generate sound.
  • Live loops let code change during performance, supporting live coding and algorave shows.

Related entries

Glossary term

Live Coding

MusicProgramming

Performance practice in which artists write and modify computer code in real time to generate music or visuals, often with the code projected.

Technology

SuperCollider

AudioMusicProgrammingFOSS

Free and open-source platform for audio synthesis and algorithmic composition, pairing a real-time sound server with its own language.

Technology

TidalCycles

MusicProgrammingFOSS

Free and open-source live coding language, embedded in Haskell, for writing and transforming musical patterns in real time.

Technology

Raspberry Pi

HardwareProgramming

Series of small, low-cost single-board computers from the United Kingdom, created to teach computing and widely used by makers and hobbyists.

Organization

Raspberry Pi Foundation

HardwareProgramming

UK educational charity that helps young people learn computing and digital making and that created the low-cost Raspberry Pi computer.

Technology

Pure Data

AudioMusicProgrammingFOSS

Open-source visual programming language for real-time audio, music and multimedia, created by Miller Puckette in the mid-1990s.

Glossary term

Synthesizer

AudioMusicHardware

Electronic musical instrument that generates sound from electrical or digital signals, shaped by oscillators, filters, envelopes and modulation.

Featured in guides

Referenced by

Other entries that discuss or point to Sonic Pi.