html5 音频标签是否非官方地包含 .mid (MIDI)?

发布于 2024-11-03 03:31:57 字数 74 浏览 1 评论 0原文

很明显,html5 音频标签正式用于 ogg 格式。

html5 音频标签是否非官方地包含 .mid (MIDI)?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

你是暖光i 2024-11-10 03:31:57

更新:

这是一个有点老的问题,但它在谷歌上仍然排名很高,所以这里有一些对上面答案的更新 - 标准和工具在提出问题时可能还没有可用,但可能对找到这个问题的人有用今天:

另请参阅这些问题:

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:

余罪 2024-11-10 03:31:57

尽管 MIME 类型为“音频/MIDI”,但 MIDI 文件不是音频……它只是音乐表演,没有声音。换句话说,MIDI 文件存储钢琴演奏者敲击的键、敲击键的时间以及敲击键的力度,但没有实际的钢琴声音。您必须通过一个带有钢琴声音的采样器来演奏音乐,就像您必须通过自动钢琴来播放钢琴卷帘一样。 Apple QuickTime 7 内置了这样的采样器,但我不知道 QuickTime X 是否有。无论如何,您必须使用嵌入标签,它无法通过音频标签工作。

很明显,html5 音频标签的正式用途是
用于 ogg 格式。

不。HTML5 是一种标记标准。它根本不涉及音频标准化。换句话说,它告诉您如何对标记进行编码,而不是如何对音频进行编码。过去 20 年来,音频标准化一直由 ISO 运动图像专家组负责。当前的音频标准是MPEG-4 AAC(音频/mp4),之前的标准是MPEG-2 MP3(音频/mp3)。如果您要将标记标准化为 W3C HTML5 规范,那么您应该将音频标准化为 ISO MPEG-4 规范。否则,只需忽略所有标准并使用您喜欢的任何标记和音频,并制作只有您可以看到的内容。所有 PC 和手机均支持 HTML5 和 MPEG-4 开箱即用。只有备用浏览器会阻止对用户硬件 MPEG-4 播放器的访问,因此您应该通过向这些用户提供 MP4 音频文件作为简单链接来解决这些问题,他们可以单击并在帮助应用程序(如 iTunes)中打开(大约 90% 的 PC 上都有该软件)。或者您可以在这些备用浏览器中调用 FlashPlayer 并在其中加载相同的标准 MP4。

至于 Ogg,它可以在某些替代浏览器中播放,但不能在用户的 RSS 阅读器、播客阅读器、提供 Web 视图的本机应用程序以及用户可能看到您的网页的许多其他上下文中播放。在所有这些环境中都可以播放标准化音频。因此,如果您提供 Ogg,您必须将其作为 MP4 之后的第二选择,因为只有少数情况下才会需要 Ogg。

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.

苦笑流年记忆 2024-11-10 03:31:57

似乎不支持原始MIDI文件,至少在Chrome 10中是这样。

但是W3C说它支持XMF,它可以嵌入MIDI。但不确定浏览器支持。

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.

孤单情人 2024-11-10 03:31:57

引用官方 Web MIDI API 页面 (http://www.w3.org/TR/webmidi):

对于某些用户来说,“MIDI”已成为标准 MIDI 文件和通用 MIDI 的代名词。这不是这个 API 的目的;简单地播放 .SMF 文件的用例不在本规范的范围之内(例如,可以将其视为 HTML5

换句话说,W3 Org 表示浏览器对简单 MIDI 文件的支持应该通过 HTML5 标签来实现。遗憾的是,据我所知,还没有浏览器通过

To quote from the official Web MIDI API page (http://www.w3.org/TR/webmidi):

To some users, "MIDI" has become synonymous with Standard MIDI Files and General MIDI. That is not the intent of this API; the use case of simply playing back a .SMF file is not within the purview of this specification (it could be considered a different format to be supported by the HTML5 <audio> element, for example).

In other words, W3 Org says browser support for simple MIDI files should be through the HTML5 tag. Sadly, as far as I know, no browser yet supports MIDI via the <audio> tg. But I'll bet that the first one which does is going to get a huge chunk of market share. For example, the site at http://www.hymntime.com/tch has thousands of MIDI files that still have to use the old <object> tag to play. And even then, it still requires a plugin. Try explaining to a non-technical user what a "plugin" is or how to install one!

甜心小果奶 2024-11-10 03:31:57

HTML5 规范不要求浏览器支持任何特定的编解码器或编码。有一些关于未来支持类似 MIDI 声音行为的讨论,但不多 - 这些 去年邮件列表上的两个 帖子没有得到任何直接回应。

我知道 QuickTime 确实(或曾经?)支持 MIDI,并且 Safari 将播放 QuickTime 支持的任何音频,因此它可能已经在 Safari 中工作,但我还没有尝试过。

Browsers are not required to support any specific codecs or encodings by the HTML5 spec. There is some discussion around supporting MIDI-like sound behaviour in the future, but not much - these two posts on the mailing list last year didn't get any direct responses.

I know that QuickTime does (or used to?) support MIDI, and Safari will play any audio that QuickTime supports, so it may work already in Safari but I haven't tried it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文