The
screencast video continues the discussion by
exploring the delay of the all-pass filter of
as a function
of the parameter C.
Implementing the pitch-accurate algorithm
Including the all-pass filter in the basic Karplus-Strong algorithm allows the loop time to be
set to an arbitrary value, making it possible to sound a tone with any desired pitch.
This section guides you through the necessary steps to augment the basic algorithm with an
all-pass filter, including the derivation of necessary equations to calculate the delay linelength and the fractional delay. Work through the derivations requested by each of the exercises.
To begin, the pitch of the output signal is the sampling frequency
divided by the total loop delay in samples:
where
is the fractional delay introduced by the all-pass filter.
Refer to
. Derive a pair of equations that can be used to calculate the length of
the delay line
and the value of the fractional delay
.
(the "floor" operator converts the operand to an integer by selecting the largest integer that is less than the operand);
The all-pass filter delay can be approximated by
(see Moore):
Refer to
. Solve the equation for the all-pass filter coefficient C in terms of the
required fractional delay.
The all-pass filter can be inserted at any point in the loop;
shows the all-pass filter placed after
the low pass filter.
To simplify the derivation of the overall filter transfer function that relates y(n) to x(n), consider the three feedback elements (delay line, low pass filter,
and all-pass filter) to be a single element with transfer function
. Derive the transfer function of the combined element.
The elements are in cascade, so the individual transfer functions multiply together:
Refer to the block diagram of
. Considering that all three elements are represented by a single feedback element G(z),
derive the overall transfer function H(z) for the digital filter in terms of G(z).
Recall the low pass filter transfer function (
):
The all-pass filter transfer function is described by
.
Derive the overall transfer function H(z) in terms of the filter parameters g and C. Write the transfer function
in standard form as the ratio of two polynomials in z.
Project activity: karplus-strong vmi
As in the
prerequisite module , convert the pitch-accurate Karplus-Strong algorithm
into a
virtual musical instrument (
VMI )
that can be played by "MIDI Jam Session." If necessary, visit
MIDI JamSession , download the application VI .zip file, and view the
screencast video in that module to learn more about the application and how to create yourown virtual musical instrument. Your VMI will accept parameters that specify
frequency, amplitude, and duration of a single note, and will produce a corresponding array ofaudio 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 .
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.
Receive real-time job alerts and never miss the right job again
Source:
OpenStax, Musical signal processing with labview (all modules). OpenStax CNX. Jan 05, 2010 Download for free at http://cnx.org/content/col10507/1.3
Google Play and the Google Play logo are trademarks of Google Inc.
Notification Switch
Would you like to follow the 'Musical signal processing with labview (all modules)' conversation and receive update notifications?