Azzera filtri
Azzera filtri

How to make real-time frequency detector

8 visualizzazioni (ultimi 30 giorni)
Jaehyun Kim
Jaehyun Kim il 14 Ott 2018
Hi, I could make frequency detector(actually frequency analyzer) when I input several second with laptop microphone.
And, what i wanna make is real-time frequency detector. I made it with Processing (check out processing.org) with simple code.
The code i made is like below.
time_rec = 15;
fs = 8000;
recObj = audiorecorder(fs,16,1);
set(recObj,'TimerPeriod',0.1,'TimerFcn',@call);
record(recObj,time_rec);
sound(x);
function [x] = call(h,~)
x = getaudiodata(h);
X = fft(x);
N = length(X);
P = abs(X/N);
Amp = P(1:N/2+1);
Amp(2:end-1) = 2*Amp(2:end-1);
fs = 8000;
f = fs*(0:(N/2))/N;
hold off;
plot(f, Amp);
end
And it acts like cumulative analyzer, which have memory. What should i fix to make it real-time?

Risposte (0)

Prodotti


Release

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by