Timbre.js

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

Timeout

Calls a bang() after specified delay

Constructor

timer = T("timeout", timeout=1000, ...);

// ...   Input objects which will be processed
        

Properties

timer.timeout     [Number] 
timer.currentTime [Readonly]
        

Methods

// Start the timer          
timer.on();


// Stop the timer
timer.off();
        

Events

        

Example: Auto Fadeout

synth = T("*", T("adsr", 0, 0, 1.0, 3000).bang(),
               T("wav", "public/audio/amen.wav", true).load()).play();
    
timer = T("timeout", 3000, function() {
    synth.args[0].keyoff();
});
    
synth.onplay = function() {
    timer.on();
};
synth.onpause = function() {
    timer.off();
};
synth.onbang = function() {
    synth.args[0].bang();
    timer.on();
};
        

See Also:

T("interval")