Spectrogram and extracting frequencies from a recorded audio sample
2 views (last 30 days)
Show older comments
Hi,
I'm trying to create a spectrogram without using the "spectrogram" MATLAB function. I have a GUI that records and saves an audio sample, and I know I need to extract the frequency domain from this sample.
If I run the following code, I get a plot with range (y-axis) from about 0 to 50 and domain (x-axis) from 0 10. 'Time' is 10 (seconds) and 'audio' is the recorded audio sample at 44,100 samples/sec.
% number of 'time domains' across which the FFT of the sample will be calculated Nf = 1024;
spec = fft(audio);
mag = abs(spec(1:Nf/2));
timeArr = linspace(0,time,Nf/2);
plot(handles.specGraph,timeArr,mag);
I have a couple of questions - what does this y axis represent? I know it's the magnitude of the FFT of the audio sample, but what exactly is this? What are the units? (bins? dB? Watts?)
How would I extract the frequency domain from this sample? I want to ultimately plot frequency vs time to create the spectrogram, and use color coding to represent magnitude response (dB).
Thanks!
0 Comments
Answers (0)
See Also
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!