Pilcrow Records

Scripter Javascript Tutorial

javascriptmusiclogicscripterbookexcerpttutorial

55 JSON

A very useful technique for debugging is to use JSON (JavaScript Object Notation), which is a text-based format to represent an object’s contents. This is particularly useful for interrogating events passed into the HandleMIDI() function:

function HandleMIDI(event) {
	var json = JSON.stringify(event);
	Trace(json);
}

In the above example:

{"detune":0,"pitch":61,"velocity":100,"status":144,"isRealtime":false,"data1":61,"data3":0,"data2":100,"channel":1,"port":1,"articulationID":0,"beatPos":0}