Scipy.io.wavfile gives the error "WavFileWarning: chunk not understand"

I am trying to read a wav file using scipy. I'm doing it:

from scipy.io import wavfile filename = "myWavFile.wav" print "Processing " + filename samples = wavfile.read(filename) 

And I get this ugly error:

 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/wavfile.py:121: WavFileWarning: chunk not understood warnings.warn("chunk not understood", WavFileWarning) Traceback (most recent call last): File "fingerFooler.py", line 15, in <module> samples = wavfile.read(filename) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/io/wavfile.py", line 127, in read size = struct.unpack(fmt, data)[0] struct.error: unpack requires a string argument of length 4 

I am using Python 2.6.6, numpy 1.6.2 and scipy 0.11.0

Here is the wav file that is causing the problem.

Any thoughts? What is wrong here?

+6
source share
4 answers

I don’t know anything about the format of the WAV file, but digging into the scipy code, it looks like this: scipy not familiar with the piece that is present at the end of the file ( bext block bext , 2753632 bytes, if that helps). This fragment is declared as 603 bytes, so it reads past it, waiting for another byte of ID 603 bytes later - it does not find it (ends from the file) and crashes.

Have you tried it on other wav files successfully? How was this created?

+6
source

Files are no longer available (unsurprisingly after 9 months!), But for further links, the most likely reason is that he had additional metadata that scipy could not parse.

In my case, this is the default metadata (copyright, track name, etc.) that was added by Audacity - you can open the file in Audacity and use File ... Open the metadata editor to see it. Then use the "Clear" button to remove it, and try again.

The current version of scipy supports the following RIFF snippets: fmt, fact, data, and LIST. The Wikipedia page on RIFF contains more detailed information on how the WAV file is structured, for example, yours may have included an unsupported but popular INFO fragment

+15
source

I also got this error due to (presumably) metadata provided by Audacity. I exported my wav file from another DAW (Ableton Live), and scipy.io.wavfile downloaded it without errors.

+1
source

I had the same error and I could successfully convert to what he could read.

My original file was from Logic Pro. Then I used audacity to read the file.

+1
source

All Articles