简单的midi.js播放器示例

时间:2014-11-13 14:15:40

标签: javascript html midi

我一直在寻找,但我似乎找不到midi.js http://mudcu.be/midi-js/的简单播放器示例。

播放器示例非常复杂,我无法让它在我的页面中工作....我缺少什么?

 <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>
 <script src="./js/Window/DOMLoader.XMLHttp.js" type="text/javascript"></script>
 <!-- extras -->
<script src="./inc/Base64.js" type="text/javascript"></script>
<script src="./inc/base64binary.js" type="text/javascript"></script>

  <script type="text/javascript">
 MIDI.Player.loadFile("start.mid",MIDI.Player.start);
 MIDI.Player.start();

 </script>

1 个答案:

答案 0 :(得分:2)

你错过了一些进口产品。对于midi播放器,您应该使用demo-MIDIPlayer.html文件中的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/Plugin.js" type="text/javascript"></script>
<script src="./js/MIDI/Player.js" type="text/javascript"></script>
<script src="./js/Widgets/Loader.js" type="text/javascript"></script>
<script src="./js/Window/Event.js" type="text/javascript"></script>
<script src="./js/Window/DOMLoader.XMLHttp.js" type="text/javascript"></script>
<!-- jasmid package -->
<script src="./inc/jasmid/stream.js"></script>
<script src="./inc/jasmid/midifile.js"></script>
<script src="./inc/jasmid/replayer.js"></script>
<!-- extras -->
<script src="./inc/Base64.js" type="text/javascript"></script>
<script src="./inc/base64binary.js" type="text/javascript"></script>

此外,您需要先加载插件,然后才能开始播放文件。

window.onload = function () {
    MIDI.loadPlugin({
        callback: function() {
            MIDI.Player.loadFile("start.mid", MIDI.Player.start);
        }
    });
}