MIDI.js/AudioTest.html

42 lines
1.5 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>
2012-10-10 07:59:04 +02:00
<script src="./js/MIDI/audioDetect.js" type="text/javascript"></script>
<script src="./js/MIDI/loadPlugin.js" type="text/javascript"></script>
<script src="./js/MIDI/Plugin.js" type="text/javascript"></script>
<script src="./js/MIDI/Player.js" type="text/javascript"></script>
2012-11-21 10:29:46 +01:00
<script src="./js/Widgets/Loader.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>
2012-02-16 05:46:03 +01:00
<!-- base64 packages -->
2012-10-10 07:59:04 +02:00
<script src="./js/Polyfill/Base64.js" type="text/javascript"></script>
<script src="./inc/base64binary.js" type="text/javascript"></script>
2012-02-16 05:46:03 +01:00
</head>
<body>
<script type="text/javascript">
2012-11-21 10:29:46 +01:00
var loader;
2012-02-16 05:46:03 +01:00
window.onload = function () {
2012-11-21 10:29:46 +01:00
loader = new widgets.Loader;
2012-11-21 10:29:05 +01:00
MIDI.loadPlugin({
instruments: [ "acoustic_grand_piano", "synth_drum" ], // or multiple instruments
2012-11-21 10:29:05 +01:00
callback: function() {
2012-11-21 10:29:46 +01:00
loader.stop();
MIDI.programChange(0, 0);
MIDI.programChange(1, 118);
2012-11-21 10:29:05 +01:00
for (var n = 0; n < 100; n ++) {
var delay = n / 4; // play one note every quarter second
var note = MIDI.pianoKeyOffset + n; // the MIDI note
var velocity = 127; // how hard the note hits
// play the note
MIDI.noteOn(0, note, velocity, delay);
// play the some note 3-steps up
2012-11-21 10:29:46 +01:00
MIDI.noteOn(1, note + 3, velocity, delay);
2012-11-21 10:29:05 +01:00
}
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>