scipy.io.wavfile给出了"WavFileWarning:不理解的块".错误 [英] scipy.io.wavfile gives "WavFileWarning: chunk not understood" error

查看:1063
本文介绍了scipy.io.wavfile给出了"WavFileWarning:不理解的块".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用scipy读取.wav文件.我这样做:

I'm trying to read a .wav file using scipy. I do this:

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

我正在使用Python 2.6.6,numpy 1.6.2和scipy 0.11.0

I'm using Python 2.6.6, numpy 1.6.2, and scipy 0.11.0

这是一个导致问题的wav文件.

Here's a wav file that causes the problem.

有什么想法吗?怎么了

推荐答案

我对WAV文件格式一无所知,但深入研究scipy代码,看起来scipy并不熟悉该块会在文件末尾显示(大块ID为bext,如果有帮助,则为2753632字节).该块被声明为603字节长,因此它读取后会期待另一个603 ID字节的块ID-找不到它(用尽了文件)并掉了.

I don't know anything about the WAV file format, but digging into the scipy code it looks like scipy isn't familiar with the chunk that's present towards the end of the file (chunk ID is bext, 2753632 bytes in, if that helps). That chunk is declared as 603 bytes long so it reads past it expecting another chunk ID 603 bytes later -- it doesn't find it (runs out of file) and falls over.

您是否已在其他WAV文件上成功尝试过?这是怎么产生的?

Have you tried it on other WAV files successfully? How was this one generated?

这篇关于scipy.io.wavfile给出了"WavFileWarning:不理解的块".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆