Fast fourier frequency detection.

8 visualizzazioni (ultimi 30 giorni)
raymon hani
raymon hani il 17 Feb 2017
Risposto: Star Strider il 17 Feb 2017
I am working on a project that detects the piano sound played and play it's notation sheet, now that i know that i will use fft for conversion into frequency domain i have used such code...
[x,Fs]= audioread('c4.wav');
xdft= fft(audioread('cs4.wave');
[~,index] sort(abs(xdft) , 'descend');
ans1= (index(1)*fs)/length(x)-(fs/length(x));
Somehow to know the answer is 261.2122 and the original Frequency of the middle C4 according to Wikipedia is 261.755 even if you think it's too close but i have tried many other samples recorded it differs according to the loudness of the sound example of outputs i got : 260.75 / 262.5 /282
i am not sure whether this code is right or not as i don't have much understanding with FFT and amplitudes so if you can please explain my path or route i need to go through i would be very much thankful
and please explain what is Fs as sample data and x as sampling rate.

Risposte (1)

Star Strider
Star Strider il 17 Feb 2017
Use the FIR filter I designed for you in Fast fourier transform in signal processing with the fftfilt function if you want to do the filtering in the frequency domain.
My Answer to your earlier Question remains valid. Change the fcuts assignment to:
fcuts = [250 258 263 271]; % Frequency Vector (Hz)
to filter ‘original Frequency of the middle C4 according to Wikipedia is 261.755’. It will be close enough with my filter.

Categorie

Scopri di più su Measurements and Spatial Audio in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by