MIDI.js/demo-Basic.html

38 lines
1.4 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
2012-02-16 05:46:03 +01:00
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- midi.js package -->
2013-01-25 09:21:16 +01:00
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>
2012-10-10 07:59:04 +02:00
<script src="./js/MIDI/Plugin.js" type="text/javascript"></script>
<script src="./js/MIDI/Player.js" type="text/javascript"></script>
2012-11-06 22:06:08 +01:00
<script src="./js/Window/DOMLoader.XMLHttp.js" type="text/javascript"></script>
<script src="./js/Window/DOMLoader.script.js" type="text/javascript"></script>
<!-- extras -->
2013-01-25 08:49:12 +01:00
<script src="./inc/WebMIDIAPI.js" type="text/javascript"></script>
<script src="./inc/Base64.js" type="text/javascript"></script>
2012-10-10 07:59:04 +02:00
<script src="./inc/base64binary.js" type="text/javascript"></script>
2012-02-16 05:46:03 +01:00
</head>
<body>
<script type="text/javascript">
window.onload = function () {
2012-11-21 10:29:05 +01:00
MIDI.loadPlugin({
soundfontUrl: "./soundfont/",
2013-01-25 08:49:12 +01:00
instrument: "acoustic_grand_piano",
2012-11-21 10:29:05 +01:00
callback: function() {
2013-01-25 08:49:12 +01:00
var delay = 0; // play one note every quarter second
var note = 50; // the MIDI note
var velocity = 127; // how hard the note hits
// play the note
2013-01-26 22:53:15 +01:00
MIDI.setVolume(0, 127);
2013-01-25 08:49:12 +01:00
MIDI.noteOn(0, note, velocity, delay);
2013-01-26 22:53:15 +01:00
MIDI.noteOff(0, note, delay + 0.75);
2012-02-16 05:46:03 +01:00
}
2012-11-21 10:29:05 +01:00
});
2012-02-16 05:46:03 +01:00
};
</script>
</body>
</html>