How to make real-time frequency detector
8 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!