Reputation: 4062
I have a sound file, which I'll call sndfile.wav. So far I have determined the number of samples, sampling rating, and the length in seconds.
[f,Fs] = wavread('mike.wav');
N = length(f);
slength = N/Fs;
Given that f is the vector containing the samples from the sound file, Fs is the sampling rate, N is the number of samples, and slength is the length of the sound file in seconds, how can I plot the sound signal with respect to time in seconds.
Upvotes: 1
Views: 24071
Reputation: 4477
moorepants answer is good for plotting the signal. If you want to do more to the signal after viewing take a look at the "Simple Audio Editor" available at file exchange. http://www.mathworks.com/matlabcentral/fileexchange/19873-simple-audio-editor
It can read an audio file directly and display it. You can also play the signal and do cut,copy and paste with the audio signal.
Upvotes: 2
Reputation: 1869
Make a time vector and then plot it versus f.
t = linspace(0, N/Fs, N)
plot(t, f)
Upvotes: 7