Hi there! I’m a newcomer to Sonic Pi from Argentina. I’ve been playing around for two days and I’m now building up a cover from a Thom Yorke song, Impossible Knots.
I’m using rings to store the sequence of notes as well as the release time of each note and the time at which each note should be played (so I can use the ‘at’ block inside my live_loop).
I ended up with 3 rings with the same number of elements with the information of each note.
bass_notes = (knit :eb3, 3, :db3, 1, ...) # note sequence
bass_note_lengths = (knit 1.5, 1, 0.75, 1, 1.5, 2, ...) # release times
bass_timings = (ring 0, 1.5, 2, 3, ...) # position of note for 'at' block
My first idea was to use tick to get the correct index for every note information:
at bass_timings do
tick(:note)
play bass_notes.look(:note), release: bass_note_lengths.look(:note)
end
But when I do this I get the first element everytime. Shouldn’t the tick be incrementing?
Finally, the following code works well for me, but I thought using tick was the cleanest way to go:
index = 0
at bass_timings do
play bass_notes[index], release: bass_note_lengths[index]
index = index + 1
end
Is there a way to make the previous code work? Or can I pass more than one ring as parameters to the ‘at’ block, e. g.: ‘at bass_timings, bass_notes, bass_note_lengths do |note, length|’?