You can find the workshop here: https://gist.github.com/berndverst/c1b47d052716327a3694358557e9c3c6
The following code can be copied and run (listened to) in Sonic Pi
use_bpm 68
use_synth :piano
load_sample :perc_snap
live_loop :hamilton_drums do
# I prefer thinking of music in measures, therefore I include 4 repeating beats. Other solutions are possible and even simpler :)
sleep 1
sample :perc_snap
sleep 2
sample :perc_snap
sleep 1
end
live_loop :hamilton_piano do
play :B2
sleep 4
play :Fs2
sleep 4
play :G2
sleep 4
play :D2
sleep 2
play :As2
sleep 2
end
The play
command allows playing multiple pitches at once by listining these in a list like [:F1, :G1]
. Update the bass line to play the same key in two adjacent octaves (an octave is a key 12 steps apart).
In synth music the most important concept is ADSR -- attack, decay, sustain and release that affect the sound. The play
command supports specifying these parameters.
On a piano holding a key means sustaining the pitch. Update your existing bass line by adding the sustain for the correct number of beats.
play :C2, sustain: 1
Go to the Bonus Solution here