I am teaching a one week course on Sonic Pi for kids at the moment and to give them an example that they probably relate to I did a version of Old Town Road.
It´s not super close to the original, but identifiable.
To better convey the rhythmical structure, I mostly use a rhythmical grid of sleep commands. I hope this is useful to anyone.
# Old Town Road
bpm = 68
live_loop :beat do
use_bpm bpm
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sample :elec_cymbal, amp: 0.3
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :elec_snare
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :elec_snare
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
end
live_loop :perc do
use_bpm bpm
sleep 3
sample :elec_tick if one_in(4)
sleep 0.125
sample :elec_tick if one_in(4)
sleep 0.125
sample :elec_tick if one_in(4)
sleep 0.125
sample :perc_snap if one_in(6)
sleep 0.125
sample :elec_tick if one_in(4)
sleep 0.125
sample :elec_flip if one_in(4)
sleep 0.125
sample :elec_tick if one_in(4)
sleep 0.125
sample :elec_tick if one_in(4)
sleep 0.125
end
with_fx :reverb, damp: 0.9, mix: 0.8, room: 0.2 do
live_loop :guitar do
use_bpm bpm
use_synth :pluck
play :c4
sleep 1
play :c4
sleep 1
play :db4
sleep 1
play :db4
sleep 1
play :db4
sleep 1
play :db4
sleep 1
play :db4
sleep 1
play :db4
sleep 1
end
live_loop :guitar_melody do
use_bpm bpm
use_synth :piano
sleep 8
play :eb5
sleep 0.5
play :db5
sleep 0.5
play :eb5
sleep 0.5
play :ab5
sleep 0.5
play :eb5
sleep 0.5
play :db5
sleep 0.5
sleep 0.5
sleep 0.5
sleep 4
end
end # fx reverb
with_fx :distortion, distort: rrand(0, 0.5) do
live_loop :bass do
use_bpm bpm
use_synth :sine
play :gs2
sample :bd_ada
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
play :gs2
sample :bd_ada
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
play :b2
sample :bd_ada
sleep 0.25
sleep 0.25
sleep 0.25
play :b2
sample :bd_ada
sleep 0.25
play :b2
sample :bd_ada
sleep 0.25
sleep 0.25
play :fs2
sample :bd_ada
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
play :fs2
sample :bd_ada
sleep 0.25
sleep 0.25
sleep 0.25
sleep 0.25
play :e2
sample :bd_ada
sleep 0.25
sleep 0.25
sleep 0.25
play :fs2
sample :bd_ada
sleep 0.25
sleep 0.25
play :fs2
sample :bd_ada
sleep 0.25
end
end # fx