#Written by Sam Humphreys
#Setting BPM to 70
use_bpm 70
#Make variables for the drums
clap = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Music Plug-Ins/Cymatics/Cymatics - Drill Essential Drum Kit/Drum One Shots/Claps/Cymatics - Wake Clap.wav"
hi_hats = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Hi hat loop for Sonic Pi.wav"
live_loop :habanera do
use_synth :fm
use_transpose -12
play (ring :d, :r, :r, :a, :f5, :r, :a, :r).tick
sleep 0.25
end
with_fx :reverb do
live_loop :space_light do
with_fx :slicer, phase: 0.25 do
synth :blade, note: :d, release: 8, cutoff: 100, amp: 2
end
sleep 8
end
end
sleep 17
loop do
sample clap
sleep 2
end
loop do
sample hi_hats
sleep 8
end
The important thing to know about loops is that they act like black holes for code. Once the code enters a loop it can never leave until you press stop - it will just go round and round the loop forever. This means if you have code after the loop you will never hear it. For example, the cymbal after this loop will never play:
loop do
play 50
sleep 1
end
sample :drum_cymbal_open
In other words, your program is stuck in the clap loop, and will never arrive at the hi_hats loop. That’s when one would use a live_loop or in_thread instead.
May i suggest you to use the samples provided in sonic pi if you want us to test your code. Otherwise, as we don’t have your own samples, sonic pi will produce no sounds
Something like that :
#Written by Sam Humphreys
#Setting BPM to 70
use_bpm 70
#Make variables for the drums
clap = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Music Plug-Ins/Cymatics/Cymatics - Drill Essential Drum Kit/Drum One Shots/Claps/Cymatics - Wake Clap.wav"
hi_hats = "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/Logic Pro X/Hi hat loop for Sonic Pi.wav"
live_loop :habanera do
use_synth :fm
use_transpose -12
play (ring :d, :r, :r, :a, :f5, :r, :a, :r).tick
sleep 0.25
end
with_fx :reverb do
live_loop :space_light do
with_fx :slicer, phase: 0.25 do
synth :blade, note: :d, release: 8, cutoff: 100, amp: 2
end
sleep 8
end
end
live_loop :clap do
# sample clap
sample :drum_tom_hi_hard
sleep 2
end
live_loop :hihats do
# sample hi_hats
sample :drum_cymbal_open
sleep 8
end