Run a block at the given times
at
[times (list), params (list)]
Given a list of times, run the block once after waiting each given time. If passed an optional params list, will pass each param individually to each block call. If params is smaller than args, the values will rotate through.
Introduced in v2.1
|
at [1, 2, 4] do play 75 end |
# plays a note after waiting 1 second, # then after 1 more second, # then after 2 more seconds (4 seconds total) |
|
at [1, 2, 3], [75, 76, 77] do |n| play n end |
# plays 3 different notes |
|
at [1, 2, 3], [{:amp=>0.5}, {:amp=> 0.8}] do |p| sample :drum_cymbal_open, p end |
# alternate soft and loud # cymbal hits three times |