Pregunta

Estoy tratando de leer un archivo * .wav usando scipy. Hago lo siguiente:

import scipy
x = scipy.io.wavfile.read('/usr/share/sounds/purple/receive.wav')

Como resultado de este código me sale:

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'

¿Alguien sabe cuál es el problema aquí? Gracias de antemano.

¿Fue útil?

Solución

Como dice el error, el módulo scipy no tiene 'io'.

io.wavfile es un sub-módulo, es necesario from scipy.io import wavfile y luego hacer wavfile.read("/usr/share/sounds/purple/receive.wav")

Esto me da un error con el archivo que está utilizando como un ejemplo, sin embargo ...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top