| > To Chapter 5
Physical Modeling The Karplus-Strong Algorithm Lets take a look at a really simple, but very effective physical model of a plucked string, called the Karplus-Strong algorithm (so named for its principal inventors, K. Karplus and A. Strong). One of the first musically useful physical models (dating from the early 1980s), the Karplus-Strong algorithm has proved quite effective at generating a variety of plucked string instrument (acoustic and electric guitars, banjo, koto) and even drum-like timbres. If you have access to a stringed instrument, particularly one with some very low notes, give one of the strings a good pluck and see if you can see and hear whats happening in the description above. How a computer models a plucked string with the Karplus Strong Algorithm Now that we have a physical idea of whats happening in a plucked string, how would we model it with a computer? The Karplus-Strong algorithm does it like this: first we start with a buffer full of random values. Noise. A buffer is just some computer memory (RAM) where we can store a bunch of numbers. The numbers in this buffer represent the initial energy that is transferred to the string by the pluck. To generate a waveform, we start reading through the buffer, and using the values in it as sample values. If we were to just keep reading through the buffer over and over again, what wed get would be a complex, pitched waveform. It would be complex because we started out with noise, but pitched because we would be repeating the same set of random numbers over and over again. Remember, any time we repeat a set of values, we end up with a pitched (periodic) sound. The pitch we get is directly related to the size of the buffer (the number of numbers it contains) were using, since each time through the buffer represents one complete cycle (or period) of the signal.
The Averaging First, what happens when we average two values? It acts as a lowpass filter on the signal. Because were averaging the signal, it changes less with each sample, and by limiting how quickly it can change were limiting the number of high frequencies it can contain (high frequencies have a high rate of change). So averaging a signal effectively gets rid of high frequencies, which according to our string description above, we need to do once the string is plucked, it should start losing harmonics over time. Instead, each time we generate a new sample we stick it back into the buffer. That way our waveform evolves as we move through it. The effect of this lowpass filtering accumulates over time, so that as the string "rings" more and more of the high frequencies are filtered out of it. The filtered waveform is then fed back into the buffer, where it is filtered again the next time through, and so on. After enough times through the process, the signal has been averaged so many times that it reaches equilibrium the waveform is a flat line, the string has died out.
For each note the switch is flipped and the computer memory buffer is filled with random values (noise). To generate a sample, values are read from the buffer and averaged. The newly calculated sample is sent both to the output stream and fed back into the buffer. When the end of the buffer is reached we simply wrap around and continue reading at the beginning. This sort of setup is often called a circular buffer. After many iterations of this process, the buffer's contents will have been transformed from noise into a simple waveform. If you think of the random noise as a lot of energy, and the averaging of the buffer as a way of lessening that energy, this digital explanation is not all that dissimilar from what happen in the real, physical case. Thanks to Matti Karjalainen for this graphic. Physical models generally offer clear, "real world" controls that can be used to play the instrument in different ways, and the Karplus-Strong algorithm is no exception: we can relate the buffer size to pitch, the initial random numbers in the buffer to the energy given to the string by plucking it, and the low-pass buffer feedback technique to the effect of air friction on the vibrating string. In reality, the vibration of a string is more complex than what weve presented here.
Understand the Building Blocks of Sound Physical modeling has become of the most powerful and important current techniques in computer music sound synthesis. One of its most attractive features is that it uses a very small number of easy to understand building blocks delays, filters, feedback loops, and common sense notions of how instruments work to model sounds. By offering the user just a few intuitive knobs (with names like "brightness," "breathiness," "pick hardness," and so on), we can use existing sound producing mechanisms to create new, often fantastic, virtual instruments.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||