Hi, I wonder if this modification of play_pattern_timed
would be a good addition to sound.rb.
def play_pattern_timed_slided(notes, times, *args)
if is_list_like?(times)
t = times.ring.repeat(notes.length/times.length+1).take(notes.length)
snth = nil
notes.each_with_index do |note, idx|
kwargs = if args.last.is_a?(Hash) then args.last else {} end
duration = t[idx]
kwargs[:duration] = duration
if (idx == 0) then
kwargs[:duration] = t.to_a.sum
snth = play(note, *[kwargs])
else
control snth, note: note, note_slide: 0.25
end
sleep(duration)
end
else
play_pattern_timed_slided(notes, [times], *args)
end
end
It is a rather a rip-off of play_pattern_timed
, but it slides the notes, rather than playing them one after the other. I know, the effect can be achieved quite easily without a new built-in, but then we also have play_pattern_timed
, I guess for those who are just starting with programming.
Thoughts, please. If someone from the core team says go, I’ll happily write the doc and place the PR.