FFT of sound wave frequency graph
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Leon Ellis
le 31 Oct 2021
Commenté : Star Strider
le 1 Nov 2021
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 commentaires
Réponse acceptée
Star Strider
le 31 Oct 2021
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 commentaires
Star Strider
le 1 Nov 2021
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.
.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Discrete Fourier and Cosine Transforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!