I wanted to input a wave file in the MATLAB so that I could process it using filters, when I come to input the wave file called wave.wav
, this file is located on my desktop, and then I used
[y, fs, nb] = wavread('wave.wav');
to read the wave file but always gives me an error cannot open file
, the only thing I can think of is that the function doesnt know the path of the wave.wav
, any help? And how can I play the file also using MATLAB after read, sound()
?
Yes, you are correct on both counts. Use the full path to the file, and use the sound
function to play it back. See this reference page for a thorough example. The documentation from the Mathworks is quite comprehensive.
This works: [y,Fs]=wavread('filename'); sound(y,Fs);
note: the filename could be any audio file. but use a converter from.mp3 to.wav coz filename must be in wav format( few even say that waveread converts the file automatically into.wav file but in my case it did not:! ) :)
Use the full path to the file and you can play the sound using soundsc(y,fs)
instead sound
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.