open wav file error
5 次查看(过去 30 天)
显示 更早的评论
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
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
2013-3-14
myFile=[PathName,FileName];
4 个评论
Image Analyst
2013-3-17
I thought this was marked as solved. Maybe you want audioplayer instead of auidoplayer.
更多回答(2 个)
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);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!