I am trying to make my first sonification (expressing data through sound) with sonic pi, and I’m having a difficult time (I should note that I am also new to ruby, but not to coding).
What I am trying to do is create a sequence for each month, and (eventually) 4 synths for each quarter of the year. The beat will count what month we are in (1 beat for January, 12 for December) and the chords will play for the number of hirees for that month (I simplified it where every one hiree is 10). The chord sequence should repeat for 4 times, as it should play for each month in a quarter. I realize my [unfinished solution] is VERY naive, but I also haven’t figure out why the ticking isn’t working. I thought I could just make rings and tick through each of the arrays, but it isn’t working. For example, the beat section starts at 2, then jumps to 5 then 7. The chord ring didn’t work at all, and using variables (c instead of chords.tick as written below) also seems to give different results. I have spent far too many hours reading the sonic pi tutorial, this forum, and mehackit (great resource) without much luck. I would appreciate anyone’s advice on ways to improve this code!
hirees = [4, 6, 8, 6, 5, 4, 4, 5, 4, 5, 4, 6].ring
percentages = [7, 9, 12, 10, 9, 6, 6, 8, 7, 8, 7, 10].ring
chords = [chord(:c, :minor7), chord(:F, :minor7), (chord :Bb, "7")].ring
synths = [:piano, :pluck].ring
months = (range -0,13)
s = synths.tick
c = chords.tick
h = hirees.tick
puts months.look
use_bpm 200
puts hirees.look
define :month_beat do
puts months.look
months.tick.times do
sample :bd_ada
sleep 0.75
end
end
month_beat
use_synth synths.tick
h.times do
play c, amp: percentages[0]/2
sleep 1
end
##| use_synth :piano
##| hirees[0].times do
##| play chord(:c, :minor7), amp: percentages[0]/2
##| sleep 1
##| end
month_beat
use_synth synths.tick
h.times do
play c, amp: percentages[1]/2
sleep 1
end
month_beat