cant get an accurate fft of live audio signal

3 ビュー (過去 30 日間)
tomer polsky
tomer polsky 2018 年 7 月 29 日
コメント済み: tomer polsky 2018 年 7 月 31 日
hello I want to get a live fft of my live audio signal. this my code , how ever my fft is wrong . could some one explain my why ?
clc;
clear all;
close all;
recorder = audiorecorder(96000, 24, 1);
disp('Start speaking.')
recorder.record(5);
while recorder.isrecording()
pause(0.1);
subplot(2,1,1);
plot(recorder.getaudiodata());
title('live recording of sound(t)')
y=getaudiodata(recorder);
fft_getaudio=fft(y,length(y));
subplot(2,1,2);
plot(linspace(0,5,length(y)),fft_getaudio);
title('live recording of fft (sound(t))')
drawnow();
end
disp('End of Recording.');
  2 件のコメント
Aquatris
Aquatris 2018 年 7 月 30 日
Check the documentation of fft function and modify their example. There are a lot of things that are wrong in your implementation.
tomer polsky
tomer polsky 2018 年 7 月 31 日
I read the fft help and tried what is written and I wote this code :
y=getaudiodata(recorder);
fft_getaudio=fft(recorder.getaudiodata());
n=1:length(fft_getaudio);
subplot(2,1,2);
plot((fft_getaudio),2.^nextpow2(n));
title('live recording of fft (sound(t))')
how ever I still get wrong plot of the fft ,any ideas ?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCode Generation and Deployment についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by