add USE_JAZZMIDI variable to enable experimental Web MIDI API, add utf8 meta tags to demos
parent
a7d5b8a06e
commit
072eadb4af
|
@ -159,6 +159,7 @@ h1 {
|
||||||
-webkit-transition-property: background, color;
|
-webkit-transition-property: background, color;
|
||||||
-webkit-transition-duration: .25s;
|
-webkit-transition-duration: .25s;
|
||||||
padding: 1px 0 1px 5px; font-family: arial; font-size: 9px; line-height: 9px; color: #aaa; width: 30px; height: 9px;
|
padding: 1px 0 1px 5px; font-family: arial; font-size: 9px; line-height: 9px; color: #aaa; width: 30px; height: 9px;
|
||||||
|
background: #000;
|
||||||
background-image: -webkit-gradient(linear,left top,left bottom,from(rgba(66,66,66,0.75)),to(rgba(0,0,0,1)));
|
background-image: -webkit-gradient(linear,left top,left bottom,from(rgba(66,66,66,0.75)),to(rgba(0,0,0,1)));
|
||||||
border-bottom: 1px solid rgba(5,5,5,0.7);
|
border-bottom: 1px solid rgba(5,5,5,0.7);
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!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">
|
<html xmlns = "http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<!-- midi.js package -->
|
<!-- midi.js package -->
|
||||||
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
|
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
|
||||||
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>
|
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!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">
|
<html xmlns = "http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<title>MIDI.js - Sequencing in Javascript.</title>
|
<title>MIDI.js - Sequencing in Javascript.</title>
|
||||||
<!-- midi.js css -->
|
<!-- midi.js css -->
|
||||||
<link href="./css/MIDIPlayer.css" rel="stylesheet" type="text/css" />
|
<link href="./css/MIDIPlayer.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!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">
|
<html xmlns = "http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<!-- midi.js package -->
|
<!-- midi.js package -->
|
||||||
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
|
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
|
||||||
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>
|
<script src="./js/MIDI/LoadPlugin.js" type="text/javascript"></script>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Whitney Music Box in HTML5</title>
|
<title>Whitney Music Box in HTML5</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<!-- midi.js package -->
|
<!-- midi.js package -->
|
||||||
<script src="./js/Color/SpaceW3.js" type="text/javascript"></script>
|
<script src="./js/Color/SpaceW3.js" type="text/javascript"></script>
|
||||||
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
|
<script src="./js/MIDI/AudioDetect.js" type="text/javascript"></script>
|
||||||
|
|
|
@ -18,6 +18,7 @@ if (typeof (MIDI.Soundfont) === "undefined") MIDI.Soundfont = {};
|
||||||
|
|
||||||
// Turn on to get "onprogress" event. XHR will not work from file://
|
// Turn on to get "onprogress" event. XHR will not work from file://
|
||||||
var USE_XHR = false;
|
var USE_XHR = false;
|
||||||
|
var USE_JAZZMIDI = false;
|
||||||
|
|
||||||
MIDI.loadPlugin = function(conf) {
|
MIDI.loadPlugin = function(conf) {
|
||||||
if (typeof(conf) === "function") conf = {
|
if (typeof(conf) === "function") conf = {
|
||||||
|
@ -40,7 +41,7 @@ MIDI.loadPlugin = function(conf) {
|
||||||
api = conf.api;
|
api = conf.api;
|
||||||
} else if (apis[window.location.hash.substr(1)]) {
|
} else if (apis[window.location.hash.substr(1)]) {
|
||||||
api = window.location.hash.substr(1);
|
api = window.location.hash.substr(1);
|
||||||
} else if (navigator.requestMIDIAccess) {
|
} else if (USE_JAZZMIDI && navigator.requestMIDIAccess) {
|
||||||
api = "webmidi";
|
api = "webmidi";
|
||||||
} else if (window.webkitAudioContext) { // Chrome
|
} else if (window.webkitAudioContext) { // Chrome
|
||||||
api = "webaudio";
|
api = "webaudio";
|
||||||
|
|
|
@ -258,7 +258,7 @@ if (window.Audio) (function () {
|
||||||
api: "audiotag"
|
api: "audiotag"
|
||||||
};
|
};
|
||||||
var note2id = {};
|
var note2id = {};
|
||||||
var volume = 1; // floating point
|
var volume = 127; // floating point
|
||||||
var channel_nid = -1; // current channel
|
var channel_nid = -1; // current channel
|
||||||
var channels = []; // the audio channels
|
var channels = []; // the audio channels
|
||||||
var notes = {}; // the piano keys
|
var notes = {}; // the piano keys
|
||||||
|
@ -276,7 +276,7 @@ if (window.Audio) (function () {
|
||||||
var time = (new Date()).getTime();
|
var time = (new Date()).getTime();
|
||||||
var audio = channels[nid];
|
var audio = channels[nid];
|
||||||
audio.src = MIDI.Soundfont[id][note.id];
|
audio.src = MIDI.Soundfont[id][note.id];
|
||||||
audio.volume = volume;
|
audio.volume = volume / 127;
|
||||||
audio.play();
|
audio.play();
|
||||||
channel_nid = nid;
|
channel_nid = nid;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue