plucky
compose musical callbacks into plucky arrangements
example
var baudio = ;var b = ;var tau = 2 * MathPI;var player = ;var music ={if t > 1 / 4 clip;return Math;}{if t > 1 / 4 clip;return Math;}{if t > 1 / 2 clip;return Math+ Math / 8;};b;b;
methods
var plucky =
var f = plucky(music, end)
Return a baudio-compatible
function given an array of music
functions.
Each function in the array music
will be called fn(t, clip)
with the relative time in seconds since it was started t
and a clip
object
described below. Musical functions should return a floating point value between
-1
and 1
, inclusive.
If provided, end()
fires when there's no more music to play.
clip.next(index)
Trigger the next musical function, if there is one.
If index
is specified, trigger the musical function at index
.
clip.end()
End the currently playing clip and trigger the next clip.
clip.destroy()
End the currently playing clip only.
clip.go(index)
Trigger the musical function at an index
in the musical array and stop playing
the current clip.
attributes
clip.t
Absolute time in seconds. This is different from the t
in f(t, clip)
, which
is a relative time in seconds for the clip since it started playing.
install
With npm do:
npm install plucky
license
MIT