Tone.Note
A timed note. Creating a note will register a callback which will be invoked on the channel at the time with whatever value was specified.
CONSTRUCTOR
new Tone.Note (channel
, time
, value
)
Members
.value
↝ string or number or Object #the value of the note. This value is returned when the channel callback is invoked.
Methods
Static Methods
.parseScore ( )
#Parses a score and registers all of the notes along the timeline.
Scores are a JSON object with instruments at the top level and an array of time and values. The value of a note can be 0 or more parameters.
The only requirement for the score format is that the time is the first (or only) value in the array. All other values are optional and will be passed into the callback function registered using Note.route(channelName, callback).
To convert MIDI files to score notation, take a look at utils/MidiToScore.js
EXAMPLE
//an example JSON score which sets up events on channels
var score = {
"synth" : [["0", "C3"], ["0:1", "D3"], ["0:2", "E3"], ... ],
"bass" : [["0", "C2"], ["1:0", "A2"], ["2:0", "C2"], ["3:0", "A2"], ... ],
"kick" : ["0", "0:2", "1:0", "1:2", "2:0", ... ],
//...
};
//parse the score into Notes
Tone.Note.parseScore(score);
//route all notes on the "synth" channel
Tone.Note.route("synth", function(time, note){
//trigger synth
});