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
)
channel

the channel name of the note

type: number or string
time

the time when the note will occur

type: Time
value

the value of the note

Members

.value

↝ string or number or Object #

the value of the note. This value is returned when the channel callback is invoked.

</>

Methods

.dispose ( )

#
↪ returns Tone.Note

this

clean up

</>

Static Methods

.parseScore ( )

#
score
type: Object
↪ returns Array

an array of all of the notes that were created

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
});
 
</>

.route ( )

#
channel

the channel to route note events from

callback

callback to be invoked when a note will occur on the specified channel

listen to a specific channel, get all of the note callbacks

</>

.unroute ( )

#
channel

The channel to unroute note events from

callback

Callback which was registered to the channel.

Remove a previously routed callback from a channel.

</>
docs generated Sep 15 2019