FFT of sound wave frequency graph
조회 수: 5 (최근 30일)
이전 댓글 표시
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));
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!