Timbre.js

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

ArrayWrapper

Array

Constructor

ary = T("array", value=[]);
ary = T([]);
        

Properties

ary.value;  // [Array]
ary.index;  // [Number]
ary.repeat; // [Number]
        

Methods

// Increments the index          
ary.bang();          
        

Events

// Script to be run when the array has reach the end
ary.onended = function() {};

// Script to be run when the array has reach the end and loop
ary.onlooped = function() {};
        

Example: Phrase

timbre.utils.exports("atof");

data  = "E3 F3 A3 C4 G3 B3 D4 B3 G#3 B3 D4 B3 C4 E4 B3 E4 ";
data += "E3 F3 A3 C4 G3 B3 D4 B3 F4 E4 D#4 E4 D4 C4 B3 C4"
    
array = T(data.split(" ").map(atof));
synth = T("fami", array, 0.25);
    
synth.onbang = function() {
    array.bang();
};


// (push [bang] button to the next tone)
        

See Also:

T("number") T("boolean")