Skip to content
A JavaScript MIDI Player
C JavaScript CSS
Branch: master
Clone or download
lpugin Merge pull request #15 from agmoyano/master
Make it posible to determine alternate location of data file
Latest commit 91e5e17 Nov 4, 2019

README.md

MIDI Player

MIDI Player is a JavaScript player based on Wild Web Midi with a simple jQuery interface. It uses instrument patches from Freepats.

Demo and example use

Try this demo for seeing / hearing it running.

Once included in your page, you only need to do (where song is a Base64 coded midi file):

<script type="text/javascript" src="wildwebmidi.js"></script>
<script type="text/javascript" src="midiplayer.js"></script>
<script type="text/javascript" src="example-song.js"></script>

$( document ).ready(function() {
    $("#player").midiPlayer({
        color: "red",
        onUnpdate: midiUpdate,
        onStop: midiStop,
        width: 250,
        locateFile: function(file) {
          //locate wildwebmidi.data
          return '/path/to/'+file;
        }
    });
    $("#player").midiPlayer.play(song);
});

Remark: you also need to include the wildwebmidi.data file that needs to be retrieved by locateFile option, or accessible from the root of your site if not specified.

The source code of the demo is available here

MIDI instruments

The player uses a piano sound font by default. Other instruments can be used, but only one at a time. For this, you need to replace the wildwebmidi.js and the wildwebmidi.data files with the instrument files you want from the ./intruments files.

For example, for using the church organ, you need to include 019_church_organ.js in your page and have 019_church_organ.data accessible from the root of your site.

Building it

For building the midi-player you need Emscripten installed on your machine.

git clone git@github.com:Mindwerks/wildmidi.git
node make
You can’t perform that action at this time.