Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected end of file wavfile.read python

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 ??

like image 217
srk Avatar asked Nov 21 '17 18:11

srk


1 Answers

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)

like image 154
LightAppleJuice Avatar answered Nov 16 '22 00:11

LightAppleJuice