plucky

compose musical callbacks into plucky arrangements

plucky

compose musical callbacks into plucky arrangements

example

var baudio = require('baudio');
var b = baudio({ rate : 44100 });
var tau = 2 * Math.PI;
var player = require('plucky');
 
var music = [
    function (tclip) {
        if (> 1 / 4) clip.end();
        return Math.sin(tau * 200 * t);
    },
    function (tclip) {
        if (> 1 / 4) clip.end();
        return Math.sin(tau * t * 200 * Math.pow(2, 1/3));
    },
    function (tclip) {
        if (> 1 / 2) clip.go(0);
        return Math.sin(tau * t * 100)
            + Math.sin(tau * t * 105) / 8
        ;
    }
];
b.push(player(music));
b.play();

methods

var plucky = require('plucky')

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.

Trigger the next musical function, if there is one.

End the currently playing musical function.

Trigger the musical function at an index in the musical array.

install

With npm do:

npm install plucky

license

MIT