简体   繁体   English

通过javascript获取音频文件的音量信息

[英]Getting volume information of audio file via javascript

Is it possible to load a wav/mp3/amr/whatever file in javascript, and to analyse it to determine the max volume of the file represented in any numerical form i dont mind? 是否可以在JavaScript中加载wav / mp3 / amr /任何文件,并对其进行分析以确定我不介意以任何数字形式表示的文件的最大音量? I need to do this without actually playing the sound so the user will not hear it. 我需要在不实际播放声音的情况下执行此操作,以便用户不会听到它。

To determine file volume (actually, 'volume' term here needs a special definition too), one actually needs to decode and stream the file, just without data reaching audio hardware. 为了确定文件的音量(实际上,这里的“音量”一词也需要一个特殊的定义),实际上需要解码和流式传输文件,而没有数据到达音频硬件。 That is, the operation requires specific audio/media API and audio processing. 即,该操作需要特定的音频/媒体API和音频处理。

In Windows an ActiveX control could do the job. 在Windows中,ActiveX控件可以完成这项工作。 JavaScript code would instantiate it and pass it file name, the control would open file, setup audio streaming pipeline internally, and process the data. JavaScript代码将实例化它并传递它的文件名,控件将打开文件,在内部设置音频流传输管道,并处理数据。 As you did not specify desired environment, this way might be or be not acceptable to you. 由于您未指定所需的环境,因此您可能会接受这种方式,或者您可能无法接受这种方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM