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? 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.
In Windows an ActiveX control could do the job. JavaScript code would instantiate it and pass it file name, the control would open file, setup audio streaming pipeline internally, and process the data. As you did not specify desired environment, this way might be or be not acceptable to you.
精彩评论