Code. Music. Live. — Write and perform Sonic Pi music directly from VS Code.
Full language support for .spi files with context-aware autocompletion for 43 synths, 96 samples, 34 FX, 150 scales, 70 chords, and 163 functions.
Press F5 to run your code, Shift+F5 to stop. Run just a selection with Ctrl+F5 (Cmd+F5 on macOS).
Hover over any synth, sample, FX, scale, chord, note, or function to see detailed documentation with options tables and code examples.
The complete 85-chapter Sonic Pi tutorial is built right into the extension. Browse chapters in the sidebar tree view or read them in a styled webview panel.
Connects to a running Sonic Pi instance over OSC with automatic port discovery, authentication, and heartbeat keep-alive. The status bar shows your connection state at a glance.
Sonic Pi runtime errors and syntax errors appear inline in the editor and in the Problems panel — no need to switch windows.
Browse and open examples organized by difficulty: Apprentice, Illusionist, Magician, and Wizard.
Start, stop, and save audio recordings as WAV files — all from within VS Code.
31 snippets for common patterns like live_loop, with_fx, play, sample, and more.
- Install Sonic Pi from sonic-pi.net
- Open Sonic Pi (the application must be running)
- Create a
.spifile in VS Code - Write some code:
live_loop :beat do sample :drum_bass_hard sleep 0.5 end
- Press F5 to hear your music!
The extension auto-connects to Sonic Pi when you open a .spi file.
- VS Code 1.109+
- Sonic Pi v4.x running on the same machine
| Keybinding | Command |
|---|---|
F5 |
Run buffer |
Shift+F5 |
Stop all |
Ctrl+F5 / Cmd+F5 |
Run selection |
| Setting | Default | Description |
|---|---|---|
sonicpi.autoConnect |
true |
Auto-connect on file open |
sonicpi.osc.host |
127.0.0.1 |
Sonic Pi server address |
sonicpi.osc.sendPort |
4557 |
OSC send port |
sonicpi.osc.listenPort |
4558 |
OSC listen port |
sonicpi.heartbeatInterval |
2000 |
Keep-alive interval (ms) |
sonicpi.sonicPiPath |
"" |
Custom Sonic Pi path |
sonicpi.logLevel |
info |
Log verbosity |
See the full User Manual for detailed configuration examples.
Open the Command Palette (Ctrl+Shift+P) and type "Sonic Pi" to see all available commands:
- Run / Run Selection / Stop
- Connect / Disconnect
- Open Tutorial / Open Examples
- Beautify Buffer
- Start Recording / Stop Recording / Save Recording
The extension includes the complete Sonic Pi tutorial:
- Click the Sonic Pi icon in the Activity Bar
- Browse chapters in the tree view
- Click a chapter to read it in a styled webview
Topics covered: synths, samples, FX, randomisation, programming structures, live coding, data structures, state, MIDI, OSC, multichannel audio, and more.
Contributions are welcome! Please open an issue or pull request on GitHub.
This extension is licensed under the MIT License.
Tutorial content is derived from the Sonic Pi project by Sam Aaron, licensed under CC BY-SA 4.0.
- Sonic Pi by Sam Aaron — the live coding music synthesizer that makes this extension possible
- The Sonic Pi community for the incredible documentation and examples