问题
I am trying to read .wav audio file by following code
from scipy.io import wavfile
file = 'PC1_20090513_050000_0010.wav'
rate, audio = wavfile.read(file)
but it is showing following error :
raise ValueError("Unexpected end of file.")
ValueError: Unexpected end of file.
Any idea ??
回答1:
It seems that you got incorrect data in the head of wav file (http://soundfile.sapp.org/doc/WaveFormat/). VLC sometimes can handle that.
Try to resave this file with any soft. For example use sox (http://sox.sourceforge.net/) and resample to the same frequency that were (like this: sox.exe wav_file -r frequency out_wav_file
)
来源:https://stackoverflow.com/questions/47419836/unexpected-end-of-file-wavfile-read-python