Read wave file

I am trying to read a wave file in matlab using the following code:
hfile = 'w1.wav';
clear y Fs
% Read the data back into MATLAB, and listen to audio.
[y, Fs, nbits, readinfo] = wavread(hfile);
y,Fs,nbits,readinfo;
sound (y, Fs);
But I get this error:
Warning: File contains uninterpretable data.
> In importdata at 144
In uiimport>runImportdata at 437
In uiimport>gatherFilePreviewData at 380
In uiimport at 210
In open at 159
In uiopen at 196
Could anyone please tell me how to get rid of it as I am unable to read the wave file and get any output.
Thank you very much!!

回答(1 个)

Based on the error you provided, I am guessing something else is going on. The error never refers to wavread. Further, I don't see how the wavread function could ever call uiopen. Have you redefined wavread?
What do you get with
which -all wavread

3 个评论

The error occurs for certain files. Its related to my project, and only the files I am dealing with gives me this error. I tried to get information about the files and it gives me something like this,
hfile = 'W4.wav';
[m d] = wavfinfo(hfile)
m =
''
d =
Not a WAVE file
It says its not a wave file but it is a wave file as I I checked it in the properties. Could you please provide me any information about this problem.
Thanks
Also, These audio files can not be run in 64 bit PC command prompt and only in 32 bit command prompt so is that the reason that it cannot be run in 64 bit Matlab 2011 version. Please let me know if that could be the reason.
Thank you very much!
Jan
Jan 2012-2-22
Sorry, Olivia, I cannot follow you. Audio files cannot run in a command prompt at all, independent on the number of bits. Audio files are only data files. So please post a copy of the command, which run or don't run and explain, what you mean by "64 bit PC command prompt".
How did you check it "in the properties", if the file is a wav file? do you mean the file properties shown by the Windows Explorer? If so, I assume its opinion is based on the file extension only... Please open the file using the MediaPlayer or any other sound program and try to play it there.

请先登录,再进行评论。

标签

提问:

2012-2-19

Community Treasure Hunt

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

Start Hunting!

Translated by