Created
August 5, 2025 19:10
-
-
Save camilajenny/7bc88b0959169ab4fc3225c361d3aee6 to your computer and use it in GitHub Desktop.
Full Sonic Pi live‑coding track from my YouTube stream: Making Music With Code | Sonic Pi Live Jam 2025-08-05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_bpm 112 | |
use_cue_logging false | |
use_debug false | |
use_real_time | |
# Section length in bars | |
section_duration = 32 | |
total_sections = 6 | |
reset_tick = section_duration * total_sections | |
# Instruments | |
kick = :bd_haus | |
snare = :sn_dub | |
hat = :drum_cymbal_closed | |
# Master Clock – every bar | |
live_loop :clock do | |
sleep 1 | |
end | |
# === SECTION MARKER === | |
live_loop :structure, sync: :clock do | |
tick | |
set :look, look | |
print(look) | |
case look | |
when 0 | |
puts "== INTRO ==" | |
when section_duration * 1 | |
puts "== BUILD ==" | |
when section_duration * 2 | |
puts "== BREAK ==" | |
when section_duration * 3 | |
puts "== DROP ==" | |
when section_duration * 4 | |
puts "== RELEASE ==" | |
when section_duration * 5 | |
puts "== OUTRO ==" | |
end | |
sleep 1 | |
if look >= reset_tick | |
tick_reset | |
end | |
end | |
swing = [0, 0.03].ring | |
# Master FX | |
with_fx :reverb, mix: 0.4 do | |
with_fx :echo, phase: 0.75, mix: 0.2 do | |
# Kick | |
live_loop :kick, sync: :clock do | |
with_fx :lpf, cutoff: 60 do | |
sample kick, start: rrand(0.2, 0.3), finish: rrand(0.8, 0.9), amp: 1 if get(:look) >= section_duration / 4 # enters after 4 bars | |
end | |
##| if one_in 32 | |
##| 4.times do | |
##| sample hat, rate: 2, amp: 0.5 | |
##| sleep 0.125 | |
##| end | |
##| end | |
sleep 1 | |
end | |
# Hat | |
live_loop :hat, sync: :clock do | |
with_fx :lpf, cutoff: 80 do | |
sleep 0.5 + swing.tick(:hat_swing) | |
sample hat, start: rrand(0, 0.05), finish: rrand(0.9, 1), amp: (spread 5,9)[get(:look)], attack: 0.3, sustain: 0.6 ? 0.6 : 0.3 | |
##| if one_in 32 | |
##| 4.times do | |
##| sample kick, rate: 6, amp: 0.2 | |
##| sleep 0.08 | |
##| end | |
##| end | |
sleep 0.5 | |
end | |
end | |
# Snare | |
live_loop :snare, sync: :clock do | |
sleep 1 | |
with_fx :lpf, cutoff: 80 do | |
sample snare, start: rrand(0, 0.05), finish: rrand(0.9, 1), amp: 0.7, attack: 0.2, sustain: 0.7, decay: 0.5 if (spread 2,4)[get(:look)] | |
##| sample :vinyl_backspin, amp: 0.5, clamp_time: 0.8 | |
sample [:vinyl_backspin, :vinyl_hiss, :vinyl_scratch].choose, clamp_time: 0.8, amp: 0.1 if spread(1, 4)[get(:look)] | |
end | |
with_fx :lpf, cutoff: 50 do | |
sample :loop_amen, beat_stretch: 0.75, rate: 4, amp: 0.3 | |
end | |
sleep 1 | |
end | |
# INTRO | |
live_loop :intro, sync: :clock do | |
if get(:look) <= section_duration | |
with_fx :lpf, cutoff: 50 do | |
use_synth :prophet | |
play [:c2, :e2, :g2].choose, sustain: 0.4, release: 0.3, amp: 0.8 | |
##| sample [:mehackit_phone1, :mehackit_robot5].choose, amp: 0.5, clamp_time: 2 if one_in 3 | |
with_fx :reverb, mix: 0.3 do | |
# Slow filter open | |
cutoff = line(50, 100, steps: 32).tick(:cut) | |
with_fx :lpf, cutoff: cutoff do | |
play chord(:c3, :minor7), release: 2, amp: 0.4 | |
end | |
end | |
sample :drum_cymbal_closed, amp: 0.3 if (spread 3,8)[tick] | |
sleep 0.5 | |
end | |
else | |
sleep 1 | |
end | |
end | |
# BUILD | |
live_loop :build, sync: :clock do | |
if section_duration < get(:look) and get(:look) <= section_duration * 2 | |
use_synth :hollow | |
play :c2, attack: 1, release: 4, amp: 0.2 | |
##| sample :ride_via, attack: 0.2, sustain: 0.6 if one_in 4 | |
sample :tbd_highkey_c4, attack: 0.3, sustain: 0.4 if one_in 3 | |
cutoff_val = line(30, 60, steps: 32).tick(:cut) | |
with_fx :lpf, cutoff: cutoff_val do | |
play :g2, attack: 0.1, release: 0.5, amp: 0.4 | |
end | |
sleep 2 | |
cutoff_val = line(20, 60, steps: 16).tick(:cut) | |
with_fx :lpf, cutoff: cutoff_val do | |
play :d2, attack: 0.1, release: 0.4, amp: 0.5 | |
end | |
sleep 2 | |
else | |
sleep 1 | |
end | |
end | |
# BREAK | |
live_loop :break, sync: :clock do | |
if section_duration * 2 < get(:look) and get(:look) <= section_duration * 3 | |
use_synth :dark_ambience | |
play [:c3, :d3, :e4], attack: 1, release: 4, amp: 0.4 | |
with_fx :rlpf, cutoff: line(80, 40, steps: 24).tick(:filter) do | |
sample kick | |
sample :ambi_choir, rate: 0.6, amp: 0.2 if one_in(4) | |
sample :perc_snap, amp: 0.3, start: rrand(0, 0.05), finish: rrand(0.9, 0.95) if (spread 1,8)[get(:look)] | |
end | |
sleep 4 | |
else | |
sleep 1 | |
end | |
end | |
# DROP | |
live_loop :drop, sync: :clock do | |
if section_duration * 3 < get(:look) and get(:look) <= section_duration * 4 | |
use_synth :tb303 | |
##| sample :sn_dolf, attack: 0.5, release: 0.8, amp: 0.5 | |
play [:c3, :e5], attack: 1, release: 4, amp: 0.2 | |
with_fx :lpf, cutoff: 40 do | |
play_pattern_timed [:c2, :d3, :g2, :b3], [0.5, 0.5, 0.5, 0.5], release: 0.3, cutoff: rrand(70, 130), amp: 0.3 | |
sleep rrand(1.8, 2.2) | |
end | |
sample :bd_haus, amp: 0.3 | |
sleep rrand(0.4, 0.6) | |
##| sample :sn_dub, amp: 0.4 | |
##| sleep rrand(0.4, 0.6) | |
else | |
sleep 1 | |
end | |
end | |
# RELEASE | |
live_loop :release, sync: :clock do | |
if section_duration * 4 < get(:look) and get(:look) <= section_duration * 5 | |
use_synth :hollow | |
play [:c3, :e3], attack: 0.3, release: 4, sustain: 2, amp: 0.4 | |
##| sample :ride_tri, attack: 0.2, sustain: 0.6 if one_in 4 | |
sleep rrand(2.9, 3.1) | |
with_fx :hpf, cutoff: 120, mix: 0.4 do | |
sample :bd_haus, amp: 1 | |
sleep rrand(0.4, 0.6) | |
sample :drum_cymbal_soft, amp: 0.3 if (spread 3,8).tick | |
sleep rrand(0.3, 0.7) | |
end | |
else | |
sleep 1 | |
end | |
end | |
# Outro Cut | |
live_loop :outro, sync: :clock do | |
if get(:look) > section_duration * 5 | |
sleep 0.8 | |
if (spread 2, 8)[get(:look)] | |
sample snare, amp: 0.5 | |
##| sample :loop_tabla, attack: 0.6, release: 0.5, clamp_time: 0.5 if spread(1, 7)[get(:look)] | |
end | |
use_synth :fm | |
play [:c2, :g2].choose, attack: 0.2, sustain: 0.5, amp: 0.4 | |
else | |
sleep 1 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment