# Title: Lead Burner
# License: cc-by
# Sonic Pi v3.4.0 (Win 11)
# Settings
use_bpm 95
bar_length = 4
use_random_seed 20210715
swing = (ring 0.01, -0.01)
# Scale
mode = :minor
scl = scale(:c1, mode, num_octaves: 5)
# Functions
define :get_pitch_from_note do |note, sample_base_note, fine_tune|
return note - sample_base_note + fine_tune
end
define :bar do |length = 8|
sleep bar_length * length
end
# Loops
define :lead do |length = 8, pattern = 1|
in_thread do
notes = (ring 21,22,23,24, 25,26,27,28).mirror.shuffle
((bar_length * length) * 4).times do ; tick
with_synth :dpulse do
play scl[notes.look],
amp: rrand(0.4, 0.5),
sustain: 0.2
end
sleep 0.25 + swing.look
end
end
end
define :lead_acc do |length = 8, pattern = 1|
in_thread do
notes = (ring 25,26,27,28).shuffle
idx = get[:lead_counter]
((bar_length * length) * 4).times do ; tick
with_fx :echo, decay: (line 1, 8, steps: 256)[idx] do
with_synth :dsaw do
play scl[notes.look],
amp: rrand(0.3, 0.6),
sustain: 0.1,
release: [0,0.5].choose
end
end
sleep 0.25 + swing.look
idx += 1
end
set :lead_counter, idx
end
end
define :lead_burner do |length = 8, pattern = 1|
in_thread do
notes = (ring 21,22,23,24, 25,26,27,28).mirror.shuffle
with_fx :ping_pong, feedback: 0.8 do
((bar_length * length) / 8).times do ; tick
use_synth_defaults wave: 2,
phase: 0.75,
range: 8,
res: (ring 0.6,0.7,0.8,0.9).look
with_synth :zawa do
play scl[notes.look],
attack: 4,
sustain: 2,
decay: 1,
release: 8,
amp: rrand(0.7, 1.0)
play scl[notes.look+3],
attack: 4,
sustain: 2,
decay: 1,
release: 8,
amp: rrand(0.7, 1.0)
end
sleep 8 + swing.look
end
end
end
end
define :bass do |length = 8, pattern = 1|
in_thread do
notes = (ring 7,8,9,10, 11,12,13,14).mirror
((bar_length * length / 4)).times do ; tick
with_synth :chipbass do
play scl[notes.choose], amp: rrand(0.5, 0.7),
sustain: 3,
decay: 1,
release: 0.2
end
sleep 4 + swing.look
end
end
end
# Reset globals
set :lead_counter, 0
# Structure
lead ; bass ; bar
lead ; bass ; bar
lead ; lead_acc ; bass ; bar
lead ; lead_acc ; bass ; bar
lead ; lead_acc ; bass ; lead_burner ; bar
lead ; lead_acc ; bass ; lead_burner ; bar
lead ; lead_acc ; bass ; lead_burner ; bar
lead(7,1) ; lead_acc(7,1) ; bass(7,1) ; lead_burner ; bar
lead ; lead_acc ; bass ; bar
lead ; lead_acc ; bass ; bar
3 Likes
This is beautiful and hypnotic and very reminiscent of Steve Reich’s music. Thanks so much for sharing this with us all
1 Like