Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

The Fundamental Frequency

Here we will elaborate on how to use the results of the EDR for each frequency to compute the wanted gain at that frequency of our loop filter. For the fundamental, we want to match a straight line to the linear decay (in dB) for the plot. As shown, the segment we highlighted in green marks a good region for a linear fit. Since we know how many dBs the signal decays on this segment, we can compute the desired gain. We have provided the code segment in our Matlab program that does this:

%% here i corresponds to the index into our arrays for the fundamental freq (328.38Hz)
curr_vals = B_EDRdbN(i,:);
segmentFrames = startFrame:endFrame;
curr_region = curr_vals(segmentFrames);
    
P = polyfit(segmentFrames,curr_region,1);
slopes(i) = P(1);
offsets(i) = P(2);

RT(i) = -60*overlapSamp/(slopes(i)*fs);
g = 10.^(-3./(RT(i)*(FUND)));
gdb = 20*log10(g);

%% here gdb is in the format necessary for Matlab to fit a filter
%% to a desired  magnitude response

Figure 14 shows the line fit to the decay of the original signal at the fundamental.

Figure 14: Overlay of the fitted straight line with the decay in energy at the fundamental
\resizebox{4.3in}{!}{\includegraphics{\figdir /06-05-22-15-fund-fit.eps}}

Figure 15 shows the extrapolated delay beginning at 0dB to -100dB at the fundamental frequency.

Figure 15: Extrapolation of our fitted decay at the fundamental frequency
\resizebox{4.3in}{!}{\includegraphics{\figdir /06-05-22-16-fund-extrap.eps}}


Next  |  Prev  |  Up  |  Top  |  REALSIMPLE Top

Download vguitar.pdf

``REALSIMPLE Basic Virtual Acoustic Guitar Lab'', by Nelson Lee and Julius O. Smith III,
REALSIMPLE Project — work supported by the Wallenberg Global Learning Network .
Copyright © 2008-06-05, by Nelson Lee and Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA