Modeling the sound of an acoustic guitar using the Karplus-Strong algorithm

Introduction/Theory:

We spent some time in lecture modeling speech by analyzing a simplified physical model and deriving the corresponding transfer function. The same thing can be done for other types of sounds, both more complex and less complex than speech. The sound of a plucked string on a guitar is one such sound.

The Karplus-Strong algorithm uses a noise burst as an initial condition, a filter of the designer's choice, and a positive feedback loop to produce a signal that sounds similar to a note being played on a guitar:

• Initial Condition: The initial input to the algorithm is a signal with length L. This corresponds to the input of energy when a guitar string is plucked. The examples at the bottom of the article show what happens to the output when random white noise, a period of a sawtooth wave, and a period of a square wave are chosen as the initial condition for the algorithm.
• The Filter: The filter is another design decision that can be chosen. This corresponds to the atmosphere and friction acting to reduce energy from the string. Depending on the characteristics of the chosen filter, you can model more energy being taken from the lower frequencies on the string, or more energy being taken from the higher frequencies on the string. The examples at the bottom of the article show what happens to the output when an IIR filter with poles near an A string's harmonic frequencies is chosen.
• The Feedback Loop: The feedback loop aspect of the algorithm is what puts all the pieces together to form the sound. The processed input is fed back into the loop to create the output signal. We didn't explicitly cover the stability of a feedback loop in 438, but it is still important to know that for this loop, the gain of the filter has to be less than 1 for any given input, for the entire system to remain stable. So, the frequency response of the filter from the previous bullet point should be less than 1 for any given frequency, to ensure the system is a stable positive feedback system.

Examples: The output signal from the above process will be a varied and random disturbance that gradually smooths out, which is a reasonably simple model of a plucked string. Here are some examples of the algorithm at work:

Example 1 Random Input Signal

Example 2 Sawtooth Cycle Input Signal

Example 3 Square Cycle Input Signal

As you can see, the random input signal sounds the most like a real-life guitar string. The sawtooth and square wave examples didn't sound like a normal guitar, but still sounded cool and could possibly be used in some other electronic music application!

## Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett