Timbre.js

JavaScript Library for Objective Sound Programming
system requirements: Chrome 14- or Firefox 4-

Add

Add signals

Constructor

add = T("+", ...);

// ...   Input objects which will be added
        

Properties

        

Methods

        

Events

        

Example: Chord

T("+", T("tri",  783, 0.25),
       T("tri", 1046, 0.25),
       T("tri", 1318, 0.25)).play();
        

Example: Arrpegio

add = T("+");

tones = [ /* loaded piano tones and stored here */ ];
score = [ [0],[1],[4],[6], [2],[5],[7],[5],
          [3],[5],[7],[5], [4,6], [], [2,5], [] ];

function play_piano(i) {
    score[i].forEach(function(x) {
        add.append(tones[x].clone());
    });
    if (add.args.length >= 4) {
        add.args.shift();
    }
}

i = 0, metro = T("interval", 300, function() {
    if (i < score.length) play_piano(i++);
});

add.onbang = function() {
    i = 0;
};
add.onplay = function() {
    metro.on();
};
add.onpause = function(){
    metro.off();
};
        

See Also:

T("*")