Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the html5 audio tag encompass .mid (MIDI) unofficially?

It seems clear that officially the html5 audio tag is intended for use with the ogg format.

Does the html5 audio tag encompass .mid (MIDI) unofficially?

like image 977
hawkeye Avatar asked Apr 26 '11 11:04

hawkeye


3 Answers

Updates:

This is a somewhat old question but it is still highly ranked on Google so here are some updates to the answers above - standards and tools that may have not been available when the question was asked but may be useful to people who find this question today:

  • Web MIDI API (this is currently a W3C Editor's Draft from December 26, 2012 - ie. today - so it may change)
  • MIDI.js - playing MIDI with JavaScript
  • jasmid - MIDI synthesis with JavaScript

See also those questions:

  • Generate live MIDI from Javascript
  • generating MIDI in javascript
like image 83
rsp Avatar answered Sep 22 '22 22:09

rsp


In spite of the MIME type "audio/midi" a MIDI file is not audio ... it is a musical performance only, there is no sound. In other words, a MIDI file stores which keys a piano player hit, when he or she hit them, and how hard he or she hit them, but no actual piano sounds. You have to put the musical performance through a sampler that has a piano sound in it, just like you have to put a piano roll through a player piano. Apple QuickTime 7 has such a sampler built-in, but I don't know if QuickTime X does. Anyway, you would have to use an embed tag, it doesn't work through the audio tag.

It seems clear that officially the html5 audio tag is intended for use with the ogg format.

No. HTML5 is a markup standard. It doesn't address audio standardization at all. In other words, it tells you how to encode markup, not how to encode audio. Audio standardization is done by ISO's Moving Picture Experts Group for the past 20 years now. The current audio standard is MPEG-4 AAC (audio/mp4), and the previous standard is MPEG-2 MP3 (audio/mp3). If you are standardizing your markup to the W3C HTML5 specification, then you should standardize your audio to the ISO MPEG-4 specification. Otherwise, just ignore all standards and use whatever markup and audio you like, and make content that only you can see. All PC's and mobiles support both HTML5 and MPEG-4 out-of-the-box. It is only the alternate browsers that block access to the user's hardware MPEG-4 player, so you should work around those by offering the MP4 audio file to those users as a simple link they can click and open in a helper app, like iTunes (which is on about 90% of all PC's). Or you can invoke a FlashPlayer in those alternate browsers and load the same standard MP4 in there.

As for Ogg, it plays in some alternate browsers, but it doesn't play in the user's RSS reader, Podcast reader, native apps that offer Web views, and in many other contexts that the user may see your web page. Standardized audio plays in all of those contexts. So if you are offering Ogg, you have to offer it as a second choice after MP4, because the Ogg is only going to be needed a small minority of the time.

like image 33
Hamranhansenhansen Avatar answered Sep 19 '22 22:09

Hamranhansenhansen


It doesn't appear to to support raw MIDI files, in Chrome 10 at least.

However, the W3C says it supports XMF which can have MIDI embedded. Not sure about browser support though.

like image 40
alex Avatar answered Sep 20 '22 22:09

alex