获得歌曲的相对响度,Javascript [英] Get Relative Loudness of Song, Javascript

查看:117
本文介绍了获得歌曲的相对响度,Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用JavaScript(以及相关的任何插件/框架(jQuery)/库)为我的网站构建一个mp3播放器。 HTML5。所以我构建了播放器(更准确地说,我实现了 jPlayer ),现在我想制作一个可视化器。

I'm trying to build an mp3 player for my site using JavaScript (and any plugins/frameworks(jQuery)/libraries that are relevant) & html5. So I built the player (more accurately, I implemented jPlayer), and now I want to make a visualizer.

好吧也许它不是一个可视化器(所有可视化声音的方式的名字总让我困惑),我猜我想要什么是这样的:

wavelenghth http://www.anthonymattox.com/wp-content/uploads/2009/04/processing_audio_waveform_spectrum_2.jpg

或只是绘制MP3幅度(响度)的图形。

所以要开始,有没有人知道可以使用的API这样做?

So to start, does anyone know an API that can do this?

如果你不这样做那么好;我想我会建立自己的。我需要知道的是:

If you don't that's ok; I guess I'll build my own. For which I need to know:

有人知道如何使用JavaScript在任何给定点获得mp3的幅度/响度吗?

更改为有关php的问题: MP3可视化 - PHP

Changed to a question about php: Visualization of MP3 - PHP

推荐答案

你会需要能够自己解码MP3。 html5音频元素和浏览器的实现不会暴露这种数据。例如,查看Firefox的JavaScript的公开方法。最接近你想要的是volumechange事件。但这是参考浏览器渲染控件(即输出音量)上的音量混合器。它与音频源的实际dB无关。

You would need to be able to decode the MP3 yourself. The html5 audio element, and the browsers's implementations of it, don't expose this sort of data. For example, look at Firefox's exposed methods for JavaScript. The closest thing to what you want is the "volumechange" event. But that is in reference to the volume mixer on the browser's rendered control (i.e. output volume). It has nothing to do with the actual dB of the audio source.

我认为唯一可行的方法是将波形提前渲染到图形中,然后在歌曲播放时显示它(例如使用timeupdate事件)。

I imagine that the only feasible way to do this is to render your waveform to a graphic ahead of time, and then "reveal" it as the song plays (e.g. with the "timeupdate" event).

这篇关于获得歌曲的相对响度,Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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