MIDIjs is a MIDI file player for web pages. It's easy to use and works with all modern browsers on Windows, MacOS, Android and iOS. MIDIjs uses the W3C Web Audio API to produce audio output. This is a 100% JavaScript solution, with no need for plugins or extensions.
For browsers not not yet supporting W3C Web Audio API the MIDIjs library falls back to conventional plugin-based methods to play MIDI files. However, some of the advanced features of MIDIjs are not supported or even cannot be supported in fallback mode.
Advantages of MIDIjs
Example 1: Playing MIDI files
Play Rock the Jukebox (Alan Jackson) Play Unchain my Heart (Bobby Sharp) Play Hinematov (Reiner Oberbeck) Play Woman in Love (Barbara Streisand)
Example2: Get MIDI File Playing Duration
Get Playing Durations (seconds)
Include MIDIjs into your website
Using MIDIjs to play MIDI files on your web site is as easy as this. Lets assume you have a MIDI file "hinematov.mid" on your website in a directory named "midi".
There are just two steps to let it play:
1. Include the following script statement into your page's header
<script type='text/javascript' src='//www.midijs.net/lib/midi.js'></script>
2. Create a link to play the file
<a href="#" onClick="MIDIjs.play('midi/hinematov.mid');">Play hinematov.mid</a>
Optional: Provide a link to stop playback at any time
<a href="#" onClick="MIDIjs.stop();">Stop MIDI Playback</a>
As you note, the script will provide the JavaScript object MIDIjs with functions MIDIjs.play(url) and MIDIjs.stop() to play MIDI files and to stop playback at any time.
More Detailed MIDIjs API Description
Browsers where MDIjs works with Web Audio API
The following browsers have been positively tested. If version x of a browser works you may assume, that version x+1 also works. These are the positive cases. However, I did not make a comprehensive test of all browsers and operating systems that exist.
Microsoft Windows
MacOS
Linux
Android
iOS
- Safari on iPhone and iPad on iOS 7
- Google Chrome 31 on iOS 7
The following browsers are not supported by MIDIjs. If version x does not work you may assume, that version x-1 also does not work.
Windows
Android
MacOS
iOS