意外的文件 wavfile.read python 结尾 [英] Unexpected end of file wavfile.read python

查看:67
本文介绍了意外的文件 wavfile.read python 结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下代码读取 .wav 音频文件

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)

但它显示以下错误:

raise ValueError("Unexpected end of file.")
ValueError: Unexpected end of file.

有什么想法吗??

推荐答案

您似乎在 wav 文件 (http://soundfile.sapp.org/doc/WaveFormat/).VLC 有时可以处理.尝试使用任何软件重新保存此文件.例如使用 sox (http://sox.sourceforge.net/) 并重新采样到相同的频率是(像这样:sox.exe wav_file -r frequency out_wav_file)

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)

这篇关于意外的文件 wavfile.read python 结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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