Why certain .wav files cannot be decoded in Firefox

陌路散爱 提交于 2019-12-01 05:52:07

It might be the JUNK chunk at the start of the file. You can run it through sox to clean out extraneous chunks like this:

sox Malice_Bass.wav Malice_Bass_simple.wav

Here's what my personal parser says about the file:

RIFF - WAVE (36467192 bytes)
   JUNK (92)
   bext (602)
         Description:       
         Originator:        Pro Tools
         Originator Ref:    jicj!dad1ofaaaGk
         Origination Date:  2014-09-09
         Origination Time:  20:46:43
         Time Ref Low:      0
         Time Ref High:     0
         BWF Version:       0
         SMPTE UMID Bytes:  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
         Coding History:    
   fmt (40)
         Format Tag:        1
         Channels:          2
         Samples per sec:   48000
         Avg bytes per sec: 192000
         Block align:       4
         Bits per sample:   16
   minf (16)
   elm1 (214)
   data (36466048)
   regn (92)
   umid (24)

When I clean it up using sox Firefox quits complaining about it but still doesn't play it. I confirmed that it loads the file but doesn't seem to play it.

I've recently had this problem with Firefox not reading wav files using the browser's audio api and found out that the problem was the bit depth of the audio file which should not exceed 16bits in order to be recognized by Firefox. I've also found out that this is a 8 years old Firefox "bug" which is quite surprising (https://bugzilla.mozilla.org/show_bug.cgi?id=524109)

My soultion was to downgrade any wav files with 32 bit depth to 16bit via sox commandline like this: sox input.wav -b 16 output.wav. You could obviously use ffmpeg or any other application which can do that under Linux. Hope that helps.

That wav file is silent for first 20 seconds. I just downloaded it :

wget https://mpclubtest.s3.amazonaws.com/Malice_Bass.wav

I tried using chrome and the fiddle was silent, initially I thought due to fact I'm just using laptop speakers. A FFT using audacity says its just very low freqs starting after 20 sec of silence.

Web Audio API uses the computer's default sampling rate, which is typically 44.1kHz Since the file is using 48 kHz, is your machine configured with a 48 kHz smple rate ? If you resample that file which is 48 kHz down to 44.1kHz which is a typical computer's sample rate it'll probably work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!