- #1

- 19

- 0

my source code is as follows. The variable framed is components of the signal required to be processed. So if the waveform of chord A starts at time 1.2 seconds and starts to dissipate at 3.4 seconds, framed would be the signal components from 1.2 until approximately 2.5 seconds.

y = fft(framed);

m = abs(y); % absolute value to eliminate the imaginary components

blocksize = 8000;

% Avoid taking the log of 0.

index = find(m == 0);

xfft(index) = 1e-17;

mag = 20*log(m); % take the magnitude of the fft in dB

mag = mag(1:floor(blocksize/2));

f = (0:length(mag)-1)*Fs/blocksize;

f = f(:);

% Now create a frequency vector for the x-axis and plot the magnitude and phase.

%f = (0:length(framed)-1)'*100/length(framed);

figure;plot(f,mag),

ylabel('Abs. Magnitude'), grid on

xlabel('Frequency [Hertz]')

[ymax,maxindex]= max(mag); % takes the max values

maxindex

ymax

When running this program, the desired output waveform does not show the frequency of chord A (440 Hz) but rather something else. Please help me! Our thesis doesnt seem to be progressing anymore because of this minor but irritable problem. If anyone can please help me on this. Thanks!

miguel.mcervantes@gmail.com

or

blue_raver19@yahoo.com