Fast fourier frequency detection.
9 views (last 30 days)
Show older comments
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.
Answers (1)
Star Strider
on 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.
0 Comments
See Also
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!