### General Loop-Filter Design

For general loop-filter design in vibrating string models (as well as in woodwind and brass instrument bore models), we wish to minimize [428, pp. 182-184]:

- Errors in partial overtone
*decay times* - Errors in partial overtone
*tuning*

There are numerous methods for designing the string loop filter
based on measurements of real string behavior. In
[428], a variety of methods for *system identification*
[288] were explored for this purpose, including
``periodic linear prediction'' in which a linear combination of a
small group of samples is used to predict a sample one period away
from the midpoint of the group. An approach based on a genetic
algorithm is described in [378]; in that work,
the error measure used with the genetic algorithm is based on
properties of human perception of short-time spectra, as is now
standard practice in digital audio coding [62].
Overviews of other approaches appear in [29] and
[508].

Below is an outline of a simple and effective method used (ca. 1995) to design loop filters for some of the Sondius sound examples:

- Estimate the fundamental frequency (see §6.11.4 below)
- Set a Hamming FFT-window length to approximately four periods
- Compute the short-time Fourier transform (STFT)
- Perform a sinusoidal modeling analysis [466] to
- -
- detect peaks in each spectral frame, and
- -
- connect peaks through time to form
*amplitude envelopes*

- Fit an exponential to each amplitude envelope
- Prepare the desired frequency-response, sampled at the harmonic
frequencies of the delay-line loop
*without*the loop filter. At each harmonic frequency,- -
- the nearest-partial decay-rate gives the desired loop-filter gains,
- -
- the nearest-partial peak-frequency give the desired loop-filter phase delay.

- Use a phase-sensitive filter-design method such as
`invfreqz`in matlab to design the desired loop filter from its frequency-response samples (further details below).

Physically, amplitude envelopes are expected to decay
*exponentially*, although coupling phenomena may obscure the
overall exponential trend. On a dB scale, exponential decay is a
*straight line*. Therefore, a simple method of estimating the
exponential decay time-constant for each overtone frequency is to fit
a straight line to its amplitude envelope and use the slope of the
fitted line to compute the decay time-constant. For example, the
matlab function `polyfit` can be used for this purpose (where
the requested polynomial order is set to 1). Since ``beating'' is
typical in the amplitude envelopes, a refinement is to replace the raw
amplitude envelope by a piecewise linear envelope that connects the
upper local maxima in the raw amplitude envelope. The estimated
decay-rate for each overtone determines a sample of the loop-filter
amplitude response at the overtone frequency. Similarly, the overtone
frequency determines a sample of the loop-filter phase response.

Taken together, the measured overtone decay rates and tunings
determine samples of the complex frequency response of the desired
loop filter. The matlab function `invfreqz`^{7.11}
can be used to convert these complex
samples into recursive filter coefficients (see §8.6.4 for a related example).
A weighting function inversely proportional to frequency is recommended. Additionally,
Steiglitz-McBride iterations can improve the results
[287], [428, pp. 101-103]. Matlab's version of
`invfreqz` has an iteration-count argument for specifying the number of
Steiglitz-McBride iterations. The maximum filter-gain versus
frequency should be computed, and the filter should be renormalized,
if necessary, to ensure that its gain does not exceed 1 at any
frequency; one good setting is that which matches the overall decay rate
of the original recording.

**Next Section:**

Damping Filter Design

**Previous Section:**

Equivalent Forms