Hello,
For a 8H project of 2H per week, I have to create a program and the one that i have chosen is a ‘Voez’-like in Python, and decided to use Sonic pi for the music.
Learning in this lapse of time to code in Sonic Pi was hard, so I learned all that I could and took some template on that incredible world that is internet.
The thing is that my brain is stucked on the C/C++ programming langage and I’m lost about what to do for this program :
define :normalDrum do
hat [5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0]
kick [9, 0, 9, 0, 0, 0, 0, 0, 9, 0, 0, 3, 0, 0, 0, 0]
snare [0, 0, 0, 0, 9, 0, 0, 2, 0, 1, 0, 0, 9, 0, 0, 1]
end
define :breakDrum do
hat [5, 0, 0, 5, 5, 0, 5, 0, 5, 0, 5, 0 , 5, 0, 5, 0]
kick [9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9]
snare [0, 0, 3, 5, 0, 3, 5, 0, 3, 3, 4, 4, 5, 5, 7, 0]
end
define :use_kit do |kit_name|
current_drum_kit = drum_kits[kit_name]
end
define :hat do |pattern|
run_pattern :hat, pattern
end
define :kick do |pattern|
run_pattern :kick, pattern
end
define :snare do |pattern|
run_pattern :snare, pattern
end
normalDrum()
live_loop :pulse do
sleep 0.05
end
define :run_pattern do |name, pattern|
live_loop name do
if switch < 3
normalDrum()
switch = switch + 1
else
breakDrum()
switch = 0
end
sync :pulse
pattern.each do |p|
sample current_drum_kit[name], amp: p/9.0
sleep 0.25
end
end
end
The aim is to play 3 times the normalDrum(), and then play the breakDrum() once. It works the first time, but then it play 1 time the normalDrum() and one time the breakDrum(). Any idea about how to solve it (or any question) ?
Thank you a lot !