Audioread cannot find WAV file
8 views (last 30 days)
Show older comments
Carolyn Murray
on 19 Dec 2019
Answered: Image Analyst
on 20 Dec 2019
Hello,
we are trying to load a WAV audio file into matlab for filtering. Oddly, It cannot seem to load the audio file without running into an incorrect path error. I have tried resetting the userpath and have also tried specifying the exact file location of audiofile instead of the file name. I have also tried turning the file location into a string variable named file but the results are the same. I am a bit puzzled in terms of what I might be doing wrong.
userpath("C:\Users\Jerry\Desktop\eeglab_current\eeglab2019_1")
[y,Fs] = audioread("PLEAS_43s_Male_Laugh")
0 Comments
Accepted Answer
Star Strider
on 19 Dec 2019
Settting the userpath may not be doing what you believe it is doing.
Also, for best results, include the extension:
[y,Fs] = audioread("PLEAS_43s_Male_Laugh.wav")
Obviously I cannot test this, so I am posting it as UNTESTED CODE.
0 Comments
More Answers (1)
Image Analyst
on 20 Dec 2019
Try this:
folder = 'C:\Users\Jerry\Desktop\eeglab_current\eeglab2019_1';
baseFileName = 'PLEAS_43s_Male_Laugh.wav'; % Include extension
fullFileName = fullfile(folder, baseFileName)
[y, Fs] = audioread(fullFileName); % Read into array
sound(y, Fs); % Play it
0 Comments
See Also
Categories
Find more on MATLAB Mobile in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!