Timbre.js

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

Interval

Calls a bang() repeatedly at regular intervals

Constructor

timer = T("interval", [delay=0], interval=1000, ...);

// ...   Input objects which will be processed
        

Properties

timer.interval    [Number]
timer.delay       [Number] 
timer.count       [Number]
timer.currentTime [Readonly]
        

Methods

// Start the timer          
timer.on();


// Stop the timer
timer.off();
        

Events

        

Example: Random marimba

synth = T("*", T("fami", 880, 0.5), T("perc", 40)).play();
    
timer = T("interval", 80, function() {
    if (timer.count % 16 === 0) {
        synth.args[0].freq.value = Math.random() * 1800 + 440;
    }
    synth.mul = (timer.count % 16) / 32 + 0.5;
    synth.args[1].bang();
});

synth.onplay = function() {
    timer.on();
};
synth.onpause = function() {
    timer.off();
};
        

See Also:

T("timeout")