Arpeggio Example - Sonic-pi Typing CST Test
Loading…
Arpeggio Example — Sonic-pi Code
Plays a simple arpeggio of a C major chord.
play 60
sleep 0.25
play 64
sleep 0.25
play 67
sleep 0.25
play 72
sleep 0.25Sonic-pi Language Guide
Sonic Pi is a live coding environment designed for creating music using code. It allows users to compose, perform, and experiment with sounds in real-time, blending programming with musical creativity.
Primary Use Cases
- ▸Teaching coding through music in schools and workshops
- ▸Live coding performances and concerts
- ▸Composing experimental electronic music
- ▸Creating interactive sound installations
- ▸Learning synthesis, loops, and algorithmic composition
Notable Features
- ▸Real-time audio synthesis and live coding
- ▸Simple Ruby-based programming syntax
- ▸Built-in samples, synths, and effects
- ▸Support for loops, threads, and concurrency
- ▸Open-source and cross-platform
Origin & Creator
Sonic Pi was created by Sam Aaron in 2011 at the University of Cambridge as a tool for teaching programming through music and live coding performances.
Industrial Note
Primarily used in education, live coding, and music experimentation. It has niche usage in digital art performances and experimental music, rather than mainstream music production.
Quick Explain
- ▸Sonic Pi provides a Ruby-based DSL for musical composition and live performance.
- ▸Users can program beats, synths, loops, and samples using code.
- ▸It encourages learning programming through music and creativity.
- ▸Supports real-time audio output with low latency.
- ▸Can be used for both educational and professional musical applications.
Core Features
- ▸`play` - plays a note or chord
- ▸`sample` - plays audio samples
- ▸`sleep` - defines duration between notes
- ▸`live_loop` - loops music in real-time
- ▸Threading and concurrency for layered compositions
Learning Path
- ▸Install Sonic Pi and familiarize with interface
- ▸Learn basic `play` and `sample` commands
- ▸Experiment with `sleep` and timing
- ▸Use `live_loop` for repeating patterns
- ▸Explore FX, synths, and concurrency
Practical Examples
- ▸Creating a drum beat using `sample :drum_bass_hard`
- ▸Playing a melody with `play :C4` and `sleep 0.5`
- ▸Live looping a bassline with `live_loop :bass`
- ▸Layering multiple synths in concurrent live loops
- ▸Using FX such as `with_fx :reverb` for atmospheric sounds
Comparisons
- ▸Sonic Pi vs Pure Data -> Pure Data: visual programming, Sonic Pi: live coding text
- ▸Sonic Pi vs SuperCollider -> SuperCollider: advanced synthesis, Sonic Pi: beginner-friendly live coding
- ▸Sonic Pi vs Ableton Live -> Ableton: GUI DAW, Sonic Pi: code-based music
- ▸Sonic Pi vs ChucK -> ChucK: precise timing, Sonic Pi: easy learning and education
- ▸Sonic Pi vs TidalCycles -> TidalCycles: pattern-based, Sonic Pi: live coding with loops and synths
Strengths
- ▸Instant feedback via live audio output
- ▸Bridges programming and music education
- ▸Highly interactive and creative environment
- ▸Strong community and extensive tutorials
- ▸Flexible for algorithmic and experimental music
Limitations
- ▸Not a full-featured DAW (Digital Audio Workstation)
- ▸Limited GUI tools for traditional music production
- ▸Requires familiarity with coding concepts
- ▸Complex compositions may become hard to manage
- ▸Dependent on computer performance for low-latency audio
When NOT to Use
- ▸Traditional DAW production workflows
- ▸Recording live instruments directly
- ▸Large-scale commercial music production
- ▸Complex orchestral scoring
- ▸Audio editing and mixing beyond live coding scope
Cheat Sheet
- ▸play :C4 - play a note
- ▸sample :drum_bass_hard - play a sample
- ▸sleep 0.5 - wait for half a beat
- ▸live_loop :name do ... end - create repeating loop
- ▸with_fx :reverb do ... end - apply effects
FAQ
- ▸Is Sonic Pi suitable for beginners? -> Yes, designed for learning music through code
- ▸Can I perform live with Sonic Pi? -> Yes, real-time live coding is its main feature
- ▸Does it work on all platforms? -> Windows, macOS, Linux supported
- ▸Do I need prior music knowledge? -> Helpful but not strictly required
- ▸Can I record my compositions? -> Yes, output can be saved as audio files
30-Day Skill Plan
- ▸Week 1: Play basic notes and samples
- ▸Week 2: Create simple loops and rhythms
- ▸Week 3: Layer multiple synths and loops
- ▸Week 4: Apply FX and modify timing creatively
- ▸Week 5: Perform a short live coding session
Final Summary
- ▸Sonic Pi is a live coding environment for music creation.
- ▸It bridges programming and musical performance for beginners and professionals.
- ▸Uses Ruby-based DSL to compose, loop, and manipulate sound in real-time.
- ▸Supports educational, experimental, and performance use cases.
- ▸Encourages creativity through code, loops, synths, samples, and FX.
Project Structure
- ▸Single `.spi` script file per composition
- ▸Optional multiple buffers for organization
- ▸Assets folder for custom samples
- ▸No complex file system required
- ▸Entire composition often contained in one live code session
Monetization
- ▸Primarily educational and hobbyist
- ▸Live coding performances and workshops
- ▸Educational courses using Sonic Pi
- ▸Digital music projects and collaborations
- ▸Open-source contribution and sponsorships
Productivity Tips
- ▸Start with simple loops and notes
- ▸Incrementally add layers and FX
- ▸Test in small sections before complex compositions
- ▸Reuse live loop patterns and functions
- ▸Focus on musicality and timing over complexity
Basic Concepts
- ▸Note values (e.g., `:C4`, `:E3`) for pitch
- ▸Synths (e.g., `:beep`, `:prophet`) for sound types
- ▸`sleep` to define note duration
- ▸`live_loop` for repeating sections
- ▸Effects (FX) and samples to modify or layer sound