我正在尝试使用scipy读取.wav文件。我这样做:
from scipy.io import wavfile filename = "myWavFile.wav" print "Processing " + filename samples = wavfile.read(filename)
我得到这个丑陋的错误:
/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
我正在使用Python 2.6.6,numpy 1.6.2和scipy 0.11.0
这是导致问题的wav文件。
有什么想法吗?怎么了
我对WAV文件格式一无所知,但深入研究scipy它看起来似乎scipy对文件末尾存在的块不熟悉(块ID为bext2753632字节,如果有帮助的话)。该块的声明长度为603字节,因此它读取后会期待另一个603 ID的块ID,但找不到(丢失文件)并掉下。
scipy
bext
您是否已在其他WAV文件上成功尝试过?这是怎么产生的?