HTML5音频 - 分析输出? [英] HTML5 Audio -- analyzing output?

查看:133
本文介绍了HTML5音频 - 分析输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法直接分析音频标签内容的输出,并使用输出?更清楚的是,我想要做的是使用音频内容的声级来使球反弹更高或更低(使用html5画布),具体取决于声音的级别。

Is there a way to directly analyze the output of the content of an audio tag, and use the output? To be more clear, what I want to do is use the sound levels of the audio content to make a ball bounce higher or lower (using html5 canvas) depending on the level of the sound.

例如,如果有类似audioElement.getVolumeLevel()的东西会很方便,虽然我不知道是否存在这样的东西。

For example, it would be really handy if there was something like audioElement.getVolumeLevel(), although I don't know if such a thing exists.

此外,这个问题具体是关于使用音频元素。我知道其他方法,但我认为这可能最适合我现在正在做的事情 - 如果存在一个简单的解决方案,那么我宁愿不必将额外的库带入我的东西。

Also, this question is specifically about using the audio element. I am aware of other methods, but I thought that this would probably work best with what I'm doing right now -- and if a simple solution exists, then I'd rather not have to bring extra libraries into my stuff.

推荐答案

在Firefox中,它是可能的,但据我所知它还没有标准化(Chrome也可能支持它):

In Firefox, it's possible but it's not yet standardized as far as I know ( Chrome probably supports it as well ):

https://wiki.mozilla.org/Audio_Data_API

Webkit API提案: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html

Webkit API proposal: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html

以及一些相关文章/演示:

And a handful of related articles / demos:

http ://ajaxian.com/by/topic/sound

http://ajaxian.com/archives/amazing-audio-api-javascript-demos

这篇关于HTML5音频 - 分析输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆