how can I play a midi file in my html/php page
Right now I surf the net and got lots of simple embed code like the one I given below
<EMBED SRC="C:\Windows\Media\Onestop.mid" hidden=true autostart=true loop=1>
But my firefox says to install plugin - Quicktime player
I dont think this is the way or how to bypass this above said issue, may be if you can suggest another method to do this if any,
thanks...
The html-midi-player package provides the <midi-player> and <midi-visualizer> HTML elements, which make it easy to play and display MIDI files on the web – no JavaScript coding required. See the GitHub repository for how to use it on your website, or try it on your MIDI files here.
To answer it simply, NO because . mid or MIDI file contains the steps and patterns of a musical instrument being played and not the sounds of the instrument when that pattern is being played. @rsp explains it well on StackOverflow in this Post. Any way to play these .
How to Play MIDI Files. MIDI files can be opened with Windows Media Player, VLC, WildMidi, TiMidity++, NoteWorthy Composer, WildMIDI, Synthesia, MuseScore, Amarok, Apple's Logic Pro, and very likely some other popular media players.
The code is simple -- just copy and paste it directly into your HTML code, then add your own MIDI files. Again, you can find MIDI files by visiting any number of MIDI archives on the Web, including those listed earlier in this chapter.
With html-midi-player, it is possible to embed a MIDI file in a website simply by inserting a midi-player
element (a custom HTML element which works a lot like the audio
element, but for MIDI files):
<midi-player src="jazz.mid" sound-font></midi-player>
Complete demo:
<midi-player src="https://cdn.jsdelivr.net/gh/cifkao/html-midi-player@2b12128/jazz.mid" sound-font>
</midi-player>
<!-- The following needs to be inserted somewhere on the page for the player(s) to work. -->
<script src="https://cdn.jsdelivr.net/combine/npm/[email protected],npm/@magenta/[email protected]/es6/core.js,npm/focus-visible@5,npm/[email protected]"></script>
Full disclosure: I'm the author of html-midi-player.
The playback functionality is provided by Google's Magenta.js library. It's also possible to use Magenta.js directly to play MIDI files, but this requires a non-trivial amount of JavaScript coding, which is why I created html-midi-player.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With