Borrar filtros
Borrar filtros

How to make real-time frequency detector

8 visualizaciones (últimos 30 días)
Jaehyun Kim
Jaehyun Kim el 14 de Oct. de 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?

Respuestas (0)

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by