A piano to hack on while going to/from work.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
592 B

window.onload = function () {
MIDI.loadPlugin({
soundfontUrl: "./soundfont/",
instrument: "acoustic_grand_piano",
callback: function() {
$('#piano').click(function(event) {
var note = $(event.target).data('note');
playNote(note)
});
}
});
};
function pianoReady() {
}
function playNote(note) {
var delay = 0; // play one note every quarter second
var velocity = 127; // how hard the note hits
MIDI.setVolume(0, 127);
MIDI.noteOn(0, note, velocity, delay);
MIDI.noteOff(0, note, delay + 0.75);
}
function getAsyncMusicData() {
}