开发者

Why scipy.io.wavfile.read does not return a tuple?

开发者 https://www.devze.com 2022-12-16 14:10 出处:网络
I am trying to read a *.wav file using scipy. I do the following: import scipy x = scipy.io.wavfile.read(\'/usr/share开发者_如何学编程/sounds/purple/receive.wav\')

I am trying to read a *.wav file using scipy. I do the following:

import scipy
x = scipy.io.wavfile.read('/usr/share开发者_如何学编程/sounds/purple/receive.wav')

As a result of this code I get:

Traceback (most recent call last):
  File "test3.py", line 2, in <module>
    x = scipy.io.wavfile.read('/usr/share/sounds/purple/receive.wav')
AttributeError: 'module' object has no attribute 'io'

Does anybody know what is wrong here? Thank you in advance.


As the error says, scipy module does not have 'io'.

io.wavfile is a submodule, you need to from scipy.io import wavfile and then do wavfile.read("/usr/share/sounds/purple/receive.wav")

This gives me an error with the file you are using as an example, however...

0

精彩评论

暂无评论...
验证码 换一张
取 消