Electric Guitars
For electric guitars, which are mainly about the vibrating string and subsequent effects processing, we pick up where §6.7 left off, and work our way up to practical complexity step by step. We begin with practical enhancements for the waveguide string model that are useful for all kinds of guitar models.
Length Three FIR Loop Filter
The simplest nondegenerate example of the loop filters of §6.8
is the three-tap FIR case (
). The symmetry constraint
leaves two degrees of freedom in the frequency response:10.1
![$\displaystyle {\hat G}(e^{j\omega T}) = {\hat g}(0) + 2{\hat g}(1) \cos(\omega T)
$](http://www.dsprelated.com/josimages_new/pasp/img1942.png)
![$ {\hat g}(0)+2{\hat g}(1)=1$](http://www.dsprelated.com/josimages_new/pasp/img1943.png)
![$\displaystyle {\hat g}(0) \ge 2{\hat g}(1) > 0.
$](http://www.dsprelated.com/josimages_new/pasp/img1944.png)
![$ {\hat g}(0)-2{\hat g}(1)\ge 0$](http://www.dsprelated.com/josimages_new/pasp/img1945.png)
![$ \omega T=\pm\pi$](http://www.dsprelated.com/josimages_new/pasp/img1946.png)
Length
FIR Loop Filter Controlled by ``Brightness'' and ``Sustain''
Another convenient parametrization of the second-order symmetric FIR
case is when the dc normalization is relaxed so that two degrees of
freedom are retained. It is then convenient to control them
as brightness and sustain
according to the
formulas
where
![$ P$](http://www.dsprelated.com/josimages_new/pasp/img1189.png)
![$ S$](http://www.dsprelated.com/josimages_new/pasp/img795.png)
![$ B$](http://www.dsprelated.com/josimages_new/pasp/img261.png)
![$ [0,1]$](http://www.dsprelated.com/josimages_new/pasp/img1241.png)
![$ S$](http://www.dsprelated.com/josimages_new/pasp/img795.png)
![$ -60$](http://www.dsprelated.com/josimages_new/pasp/img1953.png)
![$ \approx 6.91$](http://www.dsprelated.com/josimages_new/pasp/img1954.png)
![$ B$](http://www.dsprelated.com/josimages_new/pasp/img261.png)
![$ B=1$](http://www.dsprelated.com/josimages_new/pasp/img1955.png)
![$ g_0$](http://www.dsprelated.com/josimages_new/pasp/img905.png)
![$ {\hat G}(e^{j\omega T}) = g_0$](http://www.dsprelated.com/josimages_new/pasp/img1956.png)
![$ g_0$](http://www.dsprelated.com/josimages_new/pasp/img905.png)
![$\displaystyle {\hat G}(e^{j\omega T}) = g_0\frac{1 + \cos(\omega T)}{2} = g_0 \cos^2\left(\frac{\omega T}{2}\right).
$](http://www.dsprelated.com/josimages_new/pasp/img1957.png)
One-Zero Loop Filter
If we relax the constraint that
be odd, then the simplest case
becomes the one-zero digital filter:
![$\displaystyle {\hat G}(z) = {\hat g}(0) + {\hat g}(1) z^{-1}
$](http://www.dsprelated.com/josimages_new/pasp/img1958.png)
![$ {\hat g}(0)={\hat g}(1)$](http://www.dsprelated.com/josimages_new/pasp/img1959.png)
![$ 1/2$](http://www.dsprelated.com/josimages_new/pasp/img77.png)
![$ {\hat g}(0) = {\hat g}(1) = 1/2$](http://www.dsprelated.com/josimages_new/pasp/img1960.png)
![$ {\hat G}(e^{j\omega T}) = \cos\left({\omega T/ 2}\right),\,\left\vert\omega\right\vert\leq \pi f_s$](http://www.dsprelated.com/josimages_new/pasp/img1961.png)
See [454] for related discussion from a software implementation perspective.
The Karplus-Strong Algorithm
The simulation diagram for the ideal string with the simplest frequency-dependent loss filter is shown in Fig. 9.1. Readers of the computer music literature will recognize this as the structure of the Karplus-Strong algorithm [236,207,489].
![]() |
The Karplus-Strong algorithm, per se, is obtained when the
delay-line initial conditions used to ``pluck'' the string consist of
random numbers, or ``white noise.'' We know the initial shape
of the string is obtained by adding the upper and lower delay
lines of Fig. 6.11, i.e.,
. It is shown in §C.7.4 that the initial
velocity distribution along the string is determined by the
difference between the upper and lower delay lines. Thus, in
the Karplus-Strong algorithm, the string is ``plucked'' by a
random initial displacement and initial velocity distribution.
This is a very energetic excitation, and usually in practice the white
noise is lowpass filtered; the lowpass cut-off frequency gives an
effective dynamic level control since natural stringed
instruments are typically brighter at louder dynamic levels
[428,207].
Karplus-Strong sound examples are available on the Web.
An implementation of the Karplus-Strong algorithm in the Faust programming language is described (and provided) in [454].
The Extended Karplus-Strong Algorithm
Figure 9.2 shows a block diagram of the Extended Karplus-Strong (EKS) algorithm [207].
The EKS adds the following features to the KS algorithm:
![\begin{eqnarray*}
H_p(z) &=& \frac{1-p}{1 - p\,z^{-1}}\eqsp \mbox{pick-direction...
...1-R_L}{1 - R_L\,z^{-1}}\eqsp \mbox{dynamic-level lowpass filter}
\end{eqnarray*}](http://www.dsprelated.com/josimages_new/pasp/img1965.png)
where
![\begin{eqnarray*}
N &=& \mbox{pitch period ($2\times$\ string length) in samples...
...e^{j\omega T})\right\vert &\le& 1 \mbox{ required for stability}
\end{eqnarray*}](http://www.dsprelated.com/josimages_new/pasp/img1966.png)
Note that while
can be used in the tuning allpass, it
is better to offset it to
to avoid delays
close to zero in the tuning allpass. (A zero delay is obtained by a
pole-zero cancellation on the unit circle.) First-order allpass
interpolation of delay lines was discussed in §4.1.2.
A history of the Karplus-Strong algorithm and its extensions is given
in §A.8. EKS sound
examples
are also available on the Web. Techniques for designing the
string-damping filter and/or the string-stiffness allpass
filter
are summarized below in §6.11.
An implementation of the Extended Karplus-Strong (EKS) algorithm in the Faust programming language is described (and provided) in [454].
Nonlinear Distortion
In §6.13, nonlinear elements were introduced in the context of general digital waveguide synthesis. In this section, we discuss specifically virtual electric guitar distortion, and mention other instances of audible nonlinearity in stringed musical instruments.
As discussed in Chapter 6, typical vibrating strings in musical acoustics are well approximated as linear, time-invariant systems, there are special cases in which nonlinear behavior is desired.
Tension Modulation
In every freely vibrating string, the fundamental frequency declines
over time as the amplitude of vibration decays. This is due to
tension modulation, which is often audible at the beginning of
plucked-string tones, especially for low-tension strings. It happens
because higher-amplitude vibrations stretch the string to a
longer average length, raising the average string tension
faster wave propagation
higher fundamental
frequency.
The are several methods in the literature for simulating tension modulation in a digital waveguide string model [494,233,508,512,513,495,283], as well as in membrane models [298]. The methods can be classified into two categories, local and global.
Local tension-modulation methods modulate the speed of sound locally as a function of amplitude. For example, opposite delay cells in a force-wave digital waveguide string can be summed to obtain the instantaneous vertical force across that string sample, and the length of the adjacent propagation delay can be modulated using a first-order allpass filter. In principle the string slope reduces as the local tension increases. (Recall from Chapter 6 or Appendix C that force waves are minus the string tension times slope.)
Global tension-modulation methods [495,494] essentially modulate the string delay-line length as a function of the total energy in the string.
String Length Modulation
A number of stringed musical instruments have a ``nonlinear sound'' that comes from modulating the physical termination of the string (as opposed to its acoustic length in the case of tension modulation).
The Finnish Kantele [231,513] has a different effective string-length in the vertical and horizontal vibration planes due to a loose knot attaching the string to a metal bar. There is also nonlinear feeding of the second harmonic due to a nonrigid tuning peg.
Perhaps a better known example is the Indian sitar, in which a curved ``jawari'' (functioning as a nonlinear bridge) serves to shorten the string gradually as it displaces toward the bridge.
The Indian tambura also employs a thread perpendicular to the strings a short distance from the bridge, which serves to shorten the string whenever string displacement toward the bridge exceeds a certain distance.
Finally, the slap bass playing technique for bass guitars involves hitting the string hard enough to cause it to beat against the neck during vibration [263,366].
In all of these cases, the string length is physically modulated in some manner each period, at least when the amplitude is sufficiently large.
Hard Clipping
A widespread class of distortion used in electric guitars, is clipping of the guitar waveform. it is easy to add this effect to any string-simulation algorithm by passing the output signal through a nonlinear clipping function. For example, a hard clipper has the characteristic (in normalized form)
where
![$ x$](http://www.dsprelated.com/josimages_new/pasp/img179.png)
![$ x(n)$](http://www.dsprelated.com/josimages_new/pasp/img404.png)
![$ f(x)$](http://www.dsprelated.com/josimages_new/pasp/img437.png)
Soft Clipping
A soft clipper is similar to a hard clipper, but with the corners smoothed. A common choice of soft-clipper is the cubic nonlinearity, e.g. [489],
This particular soft-clipping characteristic is diagrammed in Fig.9.3. An analysis of its spectral characteristics, with some discussion of aliasing it may cause, was given in in §6.13. An input gain may be used to set the desired degree of distortion.
Enhancing Even Harmonics
A cubic nonlinearity, as well as any odd distortion law,10.2 generates only odd-numbered harmonics (like in a square wave). For best results, and in particular for tube distortion simulation [31,395], it has been argued that some amount of even-numbered harmonics should also be present. Breaking the odd symmetry in any way will add even-numbered harmonics to the output as well. One simple way to accomplish this is to add an offset to the input signal, obtaining
![$\displaystyle y(n) = f[x(n) + c],
$](http://www.dsprelated.com/josimages_new/pasp/img1972.png)
![$ c$](http://www.dsprelated.com/josimages_new/pasp/img125.png)
![$ x(n)$](http://www.dsprelated.com/josimages_new/pasp/img404.png)
Another method for breaking the odd symmetry is to add some square-law nonlinearity to obtain
where
![$ \beta$](http://www.dsprelated.com/josimages_new/pasp/img1974.png)
![$ \delta$](http://www.dsprelated.com/josimages_new/pasp/img1814.png)
![$ x(n)$](http://www.dsprelated.com/josimages_new/pasp/img404.png)
![$ \delta= - \beta$](http://www.dsprelated.com/josimages_new/pasp/img1975.png)
![$ \beta x^2$](http://www.dsprelated.com/josimages_new/pasp/img1976.png)
![$ \gamma$](http://www.dsprelated.com/josimages_new/pasp/img1977.png)
![$ x>1$](http://www.dsprelated.com/josimages_new/pasp/img1978.png)
![$ x<-1$](http://www.dsprelated.com/josimages_new/pasp/img1979.png)
![$ x$](http://www.dsprelated.com/josimages_new/pasp/img179.png)
Software for Cubic Nonlinear Distortion
The function cubicnl in the Faust software distribution (file effect.lib) implements cubic nonlinearity distortion [454]. The Faust programming example cubic_distortion.dsp provides a real-time demo with adjustable parameters, including an offset for bringing in even harmonics. The free, open-source guitarix application (for Linux platforms) uses this type of distortion effect along with many other guitar effects.
In the Synthesis Tool Kit (STK) [91], the class Cubicnl.cpp implements a general cubic distortion law.
Amplifier Feedback
A more extreme effect used with distorted electric guitars is amplifier feedback. In this case, the amplified guitar waveforms couple back to the strings with some gain and delay, as depicted schematically in Fig.9.4 [489].
The Amplifier Feedback Delay in the figure can be adjusted to
emphasize certain partial overtones over others. If the loop gain,
controllable via the Amplifier Feedback Gain, is greater than 1 at any
frequency, a sustained ``feedback howl'' will be
produced. Note that in commercial devices, the Pre-distortion gain
and Post-distortion gain are frequency-dependent, i.e., they are
implemented as pre- and post-equalizers (typically only a few
bands, such as three). Another simple choice is an integrator
for the pre-distortion gain, and a differentiator
for the post-distortion gain.
Faust software implementing electric-guitar amplifier feedback may be found in [454].
Cabinet Filtering
The distortion output signal is often further filtered by an amplifier cabinet filter, representing the enclosure, driver responses, etc. It is straightforward to measure the impulse response (or frequency response) of a speaker cabinet and fit it with a recursive digital filter design function such as invfreqz in matlab (§8.6.4). Individual speakers generally have one major resonance--the ``cone resonance''--which is determined by the mass, compliance, and damping of the driver subassembly. The enclosing cabinet introduces many more resonances in the audio range, generally tuned to even out the overall response as much as possible.
Faust software implementing an idealized speaker filter may be found in [454].
Duty-Cycle Modulation
For class A tube amplifier simulation, there should be level-dependent duty-cycle modulation as a function:10.3
- 50% at low amplitude levels (no duty-cycle modulation)
- 55-65% duty cycle at high levels
![$ \,$](http://www.dsprelated.com/josimages_new/pasp/img196.png)
Vacuum Tube Modeling
The elementary nonlinearities discussed above are aimed at approximating the sound of amplifier distortion, such as often used by guitar players. Generally speaking, the distortion characteristics of vacuum-tube amplifiers are considered superior to those of solid-state amplifiers. A real-time numerically solved nonlinear differential algebraic model for class A single-ended guitar power amplification is presented in [84]. Real-time simulation of a tube guitar-amp (triode preamp, inverter, and push-pull amplifier) based on a precomputed approximate solution of the nonlinear differential equations is presented in [293]. Other references in this area include [338,228,339].
Next Section:
Acoustic Guitars
Previous Section:
Virtual Analog Example: Phasing