Read wave file

4 views (last 30 days)
olivia
olivia on 19 Feb 2012
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!!

Answers (1)

Daniel Shub
Daniel Shub on 19 Feb 2012
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 Comments
olivia
olivia on 22 Feb 2012
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 on 22 Feb 2012
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!