Spectrogram and extracting frequencies from a recorded audio sample

3 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by