nextrh
Yield the duration to the next beat in an array on successive calls.
Syntax
Usage
nextrh iterates and cycles through an array of rhythms (in beats), returning the duration in seconds to schedule the next event in the array.
Thus an array of beat values [0.25, 0.5, 0.75, 0.5], will first return the time in seconds to reach the next 1/4 beat on the clock. Each subsequent evaluation returns a half beat (0.5), then a 3/4 beat, then a 1/2 beat again before returning to a 1/4 beat.
Outputs and arguments
iseconds -- output in seconds to the next beat value in the array.
krhythm[] -- input array of rhythms in beats.
Sid (optional, default="nrh[p1]") is a string used as a handle identifier. This can be anything but ideally is unique. nextrh uses this handle internally to keep track of which item is next to yield a result upon evaluation. Without explicitly providing the Sid, the default behaviour is to create a string based on p1 in the instrument in which it's called, however this can cause problems if multiple nextrh calls are present in the instrument definition.
idirection (optional, default=1) - Specifies the direction to iterate through the array. Can be negative and fractional.