open wav file error

5 ビュー (過去 30 日間)
The
The 2013 年 3 月 14 日
コメント済み: zaYy Nab 2017 年 5 月 9 日
When i try to open a wav file, i got this error:
Error using wavread (line 67)
Invalid Wave File. Reason: Cannot open file.
Error in gui>Open_Callback (line 125)
[mySong,sf]=wavread(myFile);
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in gui (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)gui('Open_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uimenu Callback
my code:
function Open_Callback(hObject, eventdata, handles)
global pl;
global sf;
[FileName,PathName]=uigetfile('*.wav');
myFile=[FileName,PathName];
[mySong,sf]=wavread(myFile);
[M N] = size(mySong);
i=1:1:M;
axes(handles.axes1);
axis([1 M min(mySong) max(mySong)]);
plot(i,mySong);
pl=auidoplayer(mySong,sf);
  1 件のコメント
zaYy Nab
zaYy Nab 2017 年 5 月 9 日
Invalid wave file error (line 67)occur because matlab supports specific format of audio file i-e PCM . first convert your audio from mp3 to pcm then place into current directory and run the program

サインインしてコメントする。

採用された回答

ChristianW
ChristianW 2013 年 3 月 14 日
myFile=[PathName,FileName];
  4 件のコメント
The
The 2013 年 3 月 17 日
I tried 2 different wav files. They give this error:
Undefined function 'auidoplayer' for input arguments of type 'double'.
Error in gui>Open_Callback (line 131) pl=auidoplayer(mySong,sf);
Image Analyst
Image Analyst 2013 年 3 月 17 日
I thought this was marked as solved. Maybe you want audioplayer instead of auidoplayer.

サインインしてコメントする。

その他の回答 (2 件)

Youssef  Khmou
Youssef Khmou 2013 年 3 月 14 日
hi, take that file into directory ...\Documents\MATLAB :

Image Analyst
Image Analyst 2013 年 3 月 14 日
You didn't construct the full filename properly. Use the fullfile() function:
fullFileName = fullfile(PathName, FileName);
[mySong, sf] = wavread(fullFileName);

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by