 |
This module refers to LabVIEW, a software development environment that features a graphical programming language.
Please see the LabVIEW QuickStart Guide module for tutorials and documentation that will help you: |
| • Apply LabVIEW to Audio Signal Processing |
| • Get started with LabVIEW |
| • Obtain a fully-functional evaluation edition of LabVIEW |
Introduction
In 1983 Kevin Karplus and Alex Strong published an algorithm to emulate the sound of a plucked string (see "References" section).
The Karplus-Strong algorithm produces remarkably realistic tones with modest computational effort.
As an example, consider the sound of a violin's four strings plucked in succession:
violin_plucked.wav (compare to the same four strings bowed instead of
plucked:
violin_bowed.wav). Now compare to the Karplus-Strong
version of the same four pitches:
ks_plucked.wav.
In this module, learn about the Karplus-Strong plucked string algorithm and how to create
a LabVIEW virtual musical instrument (VMI) that you can "play" using a MIDI music file.
Karplus-Strong Algorithm
The
Figure 1 screencast video develops the theory of the Karplus-Strong
plucked string algorithm, which is based on a closed loop composed of a delay line and a low pass filter.
As will be shown, the delay line is initialized with a noise burst, and the continuously circulating
noise burst is filtered slightly on each pass through the loop. The output signal is therefore quasi-periodic
with a wideband noise-like transient converging to a narrowband signal composed of only a few sinusoidal
harmonic components.
LabVIEW Implementation
The Karplus-Strong algorithm block diagram may be viewed as a single digital filter
that is excited by a noise pulse. For real-time implementation, the digital filter runs continuously with
an input that is normally zero. The filter is "plucked" by applying a burst of white noise that is long
enough to completely fill the delay line.
As an exercise, review the block diagram shown in
Figure 1 and derive
the difference equation that relates the overall output y(n) to the input x(n). Invest some effort in
this so that you can develop a better understanding of the algorithm. Watch the video solution in
Figure 2 only
after you have completed your own
derivation.
The
Figure 3 screencast video shows how to implement the difference
equation as a digital filter and how to create the noise pulse. The video includes an audio
demonstration of the finished result.
Project Activity: Karplus-Strong VMI
In order to better appreciate the musical qualities of the Karplus-Strong plucked string algorithm,
convert the algorithm to a
virtual musical instrument (
VMI for short)
that can be played by "MIDI Jam Session." If necessary, visit
MIDI Jam Session, download the application VI .zip file, and view the
screencast video in that module to learn more about the application and how to create your
own virtual musical instrument. Your VMI will accept parameters that specify
frequency, amplitude, and duration of a single note, and will produce a corresponding array of
audio samples using the Karplus-Strong algorithm described in the previous section.
For best results, select a MIDI music file that contains a solo instrument or perhaps a duet.
For example, try "Sonata in A Minor for Cello and Bass Continuo" by Antonio Vivaldi.
A MIDI version of the sonata is available at the
Classical Guitar MIDI Archives, specifically
Vivaldi_Sonata_Cello_Bass.mid.
Try experimenting with the critical parameters of your instrument, including sampling frequency and
the low-pass filter constant
g
g
MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8srps0lbbf9q8WrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfea0=yr0RYxir=Jbba9q8aq0=yq=He9q8qqQ8frFve9Fve9Ff0dmeaabaqaciGacaGaaeqabaWaaeaaeaaakeaacaWGNbaaaa@3633@
. Regarding sampling frequency: lower sampling frequencies influence
the sound in two distinct ways -- can you describe each of these two ways?
References
- Moore, F.R., "Elements of Computer Music," Prentice-Hall, 1990, ISBN 0-13-252552-6.
- Karplus, K., and A. Strong, "Digital Synthesis of Plucked String and Drum Timbres,"
Computer Music Journal 7(2): 43-55, 1983.
"This online course covers signal processing concepts using music and audio to keep the subject relevant and interesting. Written by Prof. Ed Doering from the Rose-Hulman Institute of Technology, […]"