Why do I receive an error about "incorrect chunk size" when using WAVREAD in MATLAB?

7 次查看(过去 30 天)
Using the following code:
wavread('myfile.wav')
I receive the following error:
??? Error using ==> wavread
Error using ==> wavread
Incorrect chunk size information in WAV file.

采纳的回答

MathWorks Support Team
The WAV-file that you are trying to read is most likely constructed improperly. There are two numbers written into WAV-files that are related to the size of the file itself. If these numbers are incorrect, you will receive this error.
The following function can fix your WAV-file. However, you should create a backup copy of your file before running the following function since it modifies the file.
function wavchunksizefix( filename )
d = dir(filename);
fileSize = d.bytes;
fid=fopen(filename,'r+','l');
fseek(fid,4,-1);
fwrite(fid,fileSize-8,'uint32');
fseek(fid,40,-1);
fwrite(fid,fileSize-44,'uint32');
fclose(fid);
The function is run this way:
wavchunksizefix('filename.wav')
  2 个评论
Kevin Gleason
Kevin Gleason 2016-9-27
For those experiencing this issue with AVI files. Try using MMREADER instead of AVIREAD. If you cannot or if it does not work, you will have to use some external program to read the .avi and write a new version of it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

产品


版本

R13SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by