1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ < html xmlns = "http://www.w3.org/1999/xhtml ">
3
+ < head >
4
+ < meta http-equiv ="content-type " content ="text/html; charset=utf-8 " />
5
+ <!-- midi.js package -->
6
+ < script src ="./js/MIDI/AudioDetect.js " type ="text/javascript "> </ script >
7
+ < script src ="./js/MIDI/LoadPlugin.js " type ="text/javascript "> </ script >
8
+ < script src ="./js/MIDI/Plugin.js " type ="text/javascript "> </ script >
9
+ < script src ="./js/MIDI/Player.js " type ="text/javascript "> </ script >
10
+ < script src ="./js/Window/DOMLoader.XMLHttp.js " type ="text/javascript "> </ script >
11
+ < script src ="./js/Window/DOMLoader.script.js " type ="text/javascript "> </ script >
12
+ <!-- extras -->
13
+ < script src ="./js/base64binary.js " type ="text/javascript "> </ script >
14
+ </ head >
15
+ < body >
16
+ < script type ="text/javascript ">
17
+
18
+ window . onload = function ( ) {
19
+ MIDI . loadPlugin ( {
20
+ soundfontUrl : "./soundfont/" ,
21
+ instrument : "acoustic_grand_piano" ,
22
+ callback : function ( ) {
23
+ var delay = 0 ; // play one note every quarter second
24
+ var note = 50 ; // the MIDI note
25
+ var velocity = 127 ; // how hard the note hits
26
+ // play the note
27
+ MIDI . setVolume ( 0 , 127 ) ;
28
+ MIDI . noteOn ( 0 , note , velocity , delay ) ;
29
+ MIDI . noteOff ( 0 , note , delay + 0.75 ) ;
30
+ MIDI . noteOn ( 0 , note + 10 , velocity , delay ) ;
31
+ MIDI . noteOff ( 0 , note , delay + 0.75 ) ;
32
+ }
33
+ } ) ;
34
+ } ;
35
+
36
+ </ script >
37
+ </ body >
38
+ </ html >
0 commit comments