96 kHz.org
Advanced Audio Recording

The KARPLUS-STRONG-ALGORITHM
 

The method is closely related to the memory based waveform generation we know from electrical engineering to generate any arbitrary waveforms from RAM-system using DSPs. To create a most resource saving approach K&P expanded this by including a feedback loop and a damping filter. The idea was to fill a memory with some generic content at the beginning, and then start a repeated process: The first sample leaves the memory, passes through the damping filter and is written back into the memory in modified shape. After all the samples have been run through once, the sequence repeats from the beginning, but this time the formerly set signal shape in slightly differing.

Since the periods of the frequencies in the sample in the view of the frequency domain do not necessarily match the exact length of the memory, phase issues and amplitude flaws wil occur. While this constant repetition creates a kind of pattern, the memory length is actually imposed on the signal which creates a wave guiding effect. Speaking in the words of technical signal processing, this is a convolution of the signal with itself. As a result the length of the sample set thus becomes the period of the reproduced signal with respect to the play back sampling frequency. The listener will recognize this as the fundamental frequency defining the pitch.

wave stages of the KPA-signal
 

Karpuls-Strong-Algorithm - Wave Stages over the time

 

The image shows several points of time of the content of the RAM. No matter what had been introduced, a sine wave will be the result. The timbre of the sound while the operation takes place is determined by both the preset input signal and the shape of the filter. Typically a low-pass filter is used to simulate the decay characteristics of a plucked string. Any jumps in the samples are smoothed and the harmonic content contained in the initial pattern fades away. The focus of the energy thus increasingly shifts to the fundamental tone. So even without damping, the treble decreases and in the end one actually has a sine wave.

Since the feedback also has an attenuation characteristics, the energy is slowly removed from the system over time too. Having a closer look the high-frequency components of the sound do lose their energy faster than the low-frequency components do. As a result, the signal becomes more and more similar to a sine wave over time, which is considered to meet the behavior of a guitar string.

 

DSP System

Karplus-Strong-Algorithm - TMS 320



The KPA has been implemented and tested in my 56301-Audio-System board and a self built TMS 320 based system at the university of Siegen. According to my personal taste the sound comes pretty close to a guitar sound when preparing the filter that way, that it maintains the third harmonic a bit.

Download an example file KPA-Demo and the DSP-Code here KPA-C for the TI TMS 320.

Conclusion and Summary

 Wave guide algorithms like KPA can be used for guitar sounds.

 

© 1999 - Dipl.-Ing. Jürgen Schuhmacher