Sonic Pi

Hacker News Top Tools

Summary

Sonic Pi is a live coding music synthesizer that allows users to create and perform music through programming, as illustrated by the code examples provided.

No content available
Original Article
View Cached Full Text

Cached at: 09/01/26, 11:45 PM

# Sonic Pi - The Live Coding Music Synth for Everyone Source: [https://sonic-pi.net/](https://sonic-pi.net/) ``` live_loop :bells do sample :perc_bell, rate: (rrand 0.125, 1.5) sleep rrand(0, 2) end ``` ``` with_fx :reverb, mix: 0.2 do live_loop :bleeps do play scale(:Eb2, :major_pentatonic, num_octaves: 3).choose, release: 0.1, amp: rand sleep 0.1 end end ``` ``` live_loop :bikes do with_synth :dsaw do with_fx(:slicer, phase: [0.25,0.125].choose) do with_fx(:reverb, room: 0.5, mix: 0.3) do start_note = chord([:b1, :b2, :e1, :e2, :b3, :e3].choose, :minor).choose final_note = chord([:b1, :b2, :e1, :e2, :b3, :e3].choose, :minor).choose p = play start_note, release: 8, note_slide: 4, cutoff: 30, cutoff_slide: 4, detune: rrand(0, 0.2), pan: rrand(-1, 0), pan_slide: rrand(4, 8) control p, note: final_note, cutoff: rrand(80, 120), pan: rrand(0, 1) end end end sleep 8 end ``` ``` with_fx :reverb do in_thread do live_loop :choir do r = [0.5, 1.0/3, 3.0/5].choose 8.times do sample :ambi_choir, rate: r, pan: rrand(-1, 1) sleep 0.5 end end end end with_fx :wobble, phase: 2 do |w| with_fx :echo, mix: 0.6 do live_loop :wub do sample :drum_heavy_kick sample :bass_hit_c, rate: 0.8, amp: 0.4 sleep 1 end end end ``` ``` with_fx :reverb, mix: 0.5 do live_loop :waves do s = synth [:bnoise, :cnoise, :gnoise].choose, amp: rrand(0.5, 1.5), attack: rrand(0, 4), sustain: rrand(0, 2), release: rrand(1, 3), cutoff_slide: rrand(0, 3), cutoff: rrand(60, 80), pan: rrand(-1, 1), pan_slide: 1, amp: rrand(0.5, 1) control s, pan: rrand(-1, 1), cutoff: rrand(60, 115) sleep rrand(2, 3) end end ``` ``` define :play_bb do |n| sample :drum_heavy_kick sample :ambi_drone, rate: [0.25, 0.5, 0.125, 1].choose, amp: 0.25 if rand < 0.125 sample :ambi_lunar_land, rate: [0.5, 0.125, 1, -1, -0.5].choose, amp: 0.25 if rand < 0.125 sample :loop_amen, attack: 0, release: 0.05, start: 1 - (1.0 / n), rate: [1,1,1,1,1,1,-1].choose sleep sample_duration(:loop_amen) / n end live_loop :breaks do play_bb [1,2,4,8,16].choose end ``` ``` in_thread do use_synth :fm sleep 2 live_loop :drums do 28.times do sample :drum_bass_hard, amp: 0.8 sleep 0.25 play :e2, release: 0.2 sample :elec_cymbal, rate: 12, amp: 0.6 sleep 0.25 end sleep 4 end end use_synth :tb303 with_fx :reverb do |rev| live_loop :acid do control rev, mix: rrand(0, 0.3) with_fx :slicer, phase: 0.125 do sample :ambi_lunar_land, sustain: 0, release: 8, amp: 2 end control rev, mix: rrand(0, 0.6) r = rrand(0.05, 0.3) 64.times do play chord(:e3, :minor).choose, release: r, cutoff: rrand(50, 90), amp: 0.5 sleep 0.125 end control rev, mix: rrand(0, 0.6) r = rrand(0.1, 0.2) with_synth :prophet do 32.times do sleep 0.125 play chord(:a3, :m7).choose, release: r, cutoff: rrand(40, 130), amp: 0.7 end end control rev, mix: rrand(0, 0.6) r = rrand(0.05, 0.3) 32.times do play chord(:e3, :minor).choose, release: r, cutoff: rrand(110, 130), amp: 0.4 sleep 0.125 end control rev, mix: rrand(0, 0.6) with_fx :echo, phase: 0.25, decay: 8 do 16.times do play chord([:e2, :e3, :e4].choose, :m7).choose, release: 0.05, cutoff: rrand(50, 129), amp: 0.5 sleep 0.125 end end end end ```

Similar Articles

Sonic Pi v5

Hacker News Top

Sonic Pi v5, the live coding music environment, has been released with new features and improvements.

can1357/oh-my-pi

GitHub Trending (daily)

Oh My Pi is an open-source coding agent built on Pi, offering a wired-in IDE, support for 40+ providers, built-in tools, and significant performance improvements across models.

Coffee Piano

Product Hunt

Coffee Piano is a browser-based piano studio that provides visual harmony tools for music creation.