필터 지우기
필터 지우기

FFT of sound wave frequency graph

조회 수: 2 (최근 30일)
Leon Ellis
Leon Ellis 2021년 10월 31일
댓글: Star Strider 2021년 11월 1일
Good day, I am plotting the sound wave in the frequincy domain and applying a low pass filter in the time and frequincy domain. My problem is the last graph i get in the frequincy domain subplot(3,2,6). I want it to look similar to subplot(3,2,2) in the sense that it appears as the outline of the graph. (movmax does not solve this).
After this my job is to compare the audio file's frequincy domains and determine if a spesific word i.e "one" or "five" has been said by the user. Any hints and function that could come in handy?
My code is:
[CompareWord, Fs]=audioread("C:\Users\leone\OneDrive\Desktop\Year 2\Semester 2\EERI 222\Practical1\Sounds\WordL1_5.wav"); %%.mat file is attached.
Fs=8000;
Ts=1/Fs;
dt=(0:length(CompareWord)-1)*Ts;
nfft=length(CompareWord);
nfft2=2.^nextpow2(nfft);
ff=fft(CompareWord,nfft2);
ff=ff(1:nfft2/2);
ffm=movmax(ff,50);
xfft=Fs*(0:nfft2/2-1)/nfft2;
cut_off=1.2e3/Fs/2;
order=32;
h=fir1(order,cut_off);
fh=fft(h,nfft2);
fh=fh(1:nfft2/2);
mul=fh.*ff;
con=conv(CompareWord,h);
subplot(3,2,1);
plot(dt,CompareWord);
subplot(3,2,2);
plot(xfft,abs(ffm/max(ffm))); %#ok<ADPROPLC>
hold on;
%pks=findpeaks(abs(ffm));
%%Gets center x-coordinates of local maximum values.
TF2=islocalmax(abs(ffm),'FlatSelection',"center");
x=1:length(xfft);
hold on;
plot(x,abs(ffm)/max(abs(ffm)),x(TF2),abs(ffm(TF2)/max(ffm)),'r*');
hold off;
subplot(3,2,3);
stem(h);
subplot(3,2,4);
plot(abs(fh/max(fh))); %#ok<ADPROPLC>
subplot(3,2,5);
plot(con);
subplot(3,2,6);
plot(abs(mul));

채택된 답변

Star Strider
Star Strider 2021년 10월 31일
I have no idea what the desired result actually is, even when I run the code and plot it.
See if the envelope function will produce the desired result. It has additional options and arguments.
.
  댓글 수: 6
Leon Ellis
Leon Ellis 2021년 11월 1일
So instead of mul=fh.*ff; I used conv(fh,ff);
Star Strider
Star Strider 2021년 11월 1일
Multiplying them in the frequency domain is equivalent to convolving them in the time domain, and convolving them in the frequency domain is equivalent to multiplying them in the time domain, if I remember correctly.
I am not certain what the desired result is here.
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by