You are on page 1of 4

WAVESHAPING

Waveshaping
The term waveshaping refers to a conceptually very simple signal processing technique: we take the instantaneous value of the input signal x and apply an arbitrary function y = f (x) to obtain the output value y for the same time instant. The function which takes the input x and produces the output y is called transfer function. In contrast to a lter, a waveshaper does not have memory because the instantaneous output depends solely on the instantaneous input and not on past inputs or output values. In this respect the waveshaper seems to be simpler than a lter. However, because the function f (x) can be basically anything (within reason), waveshaping is an intrinsically nonlinear process. A key feature of nonlinear processes is, that they can create new frequency components which were not present in the input signal. When the input to the waveshaper is a sinusoid with frequency f , its output will be in general a sum of sinusoids with frequencies at integer multiples of f . These additional frequencies are called harmonics. How they come about can easily be understood by considering a simple hard clipper, which just clips the input signal o at some threshold amplitude. Look at gure 1 (a): When we send a sine-wave at

(a) hard clipper

(b) soft clipper

(c) asymmetric

(d) squarer: y = x2

Figure 1: Some examples for waveshaping transfer functions some frequency through the hard clipper and turn up the amplitude of the input sine-wave, the output will more and more resemble a square wave. Now it is well known from Fourier analysis, that the square wave contains frequencies at all odd integer multiples of the fundamental frequency. So we obviously have created new frequencies which were not present in the input sinusoid. The clipper makes another feature of waveshaping apparent: the spectrum of the output signal depends on the amplitude of the input signal. Driving the hard clipper with a very loud sinusoid results in a rich output spectrum (almost that of a square wave). On the other hand, driving it with a sinusoid of unit amplitude or below will just result in the same sinusoid at the output, which has no harmonics at all (except the fundamental, of course).

Polynomials
A special family of transfer functions which are interesting for waveshaping are polynomials. A polynomial of order n is dened as:
n

f (x) = an xn + an1 xx1 + . . . + a2 x2 + a1 x + a0 =


k=0

ak x k

(1)

These polynomial functions allow for a somewhat more predictable result than arbitrary functions. Specifically, if we use a polynomial of order n, we will create only harmonics up to order n. This is a convenient 1 article available at: www.rs-met.com

Symmetric Transfer Functions / Even and Odd Harmonics

WAVESHAPING

property of polynomials in the context of waveshaping. On the other hand, an inconvenient property is, that polynomials diverge to plus or minus innity when the absolute value of the input argument becomes arbitrarily large - so we should restrict the input amplitude in practice. To see how polynomial waveshapers create harmonics, we will consider the simplest nonlinear example of the quadratic transfer 2 function y = x2 . The waveshapers output signal is therefore: y(t) = f x(t) = x(t) . Plugging in a sinusoidal input with radian frequency and amplitude A: x(t) = A sin(t) as input signal, we obtain: y(t) = A sin(t) = A2 sin2 (t) Using the trigonometric identity sin2 () =
1 2 2

(2)

1 cos(2) , we obtain:

y(t) = A2

1 1 cos(2t) 2 A 2 A2 cos(2t) = 2 2

(3)

which we recognize as a constant (i.e. a DC component) and a sinusoid at twice the frequency (albeit with a dierent phase). There are more general trigonometric identities for higher powers of sinusoidal functions which could be used for predicting the output signal of higher power waveshapers. We wont go through some more boring algebra here to demonstrate this - the general outcome will be a combination of sinusoids of frequencies at integer multiples of the input frequency, up to the highest power in the polynomial. Chebyshev Polynomials Inside the class of polynomial waveshapers, another specialization are those polynomials, which wiggle up and down between -1 and +1 as the input signal goes through the domain 1... + 1. These special polynomials are known as Chebyshev polynomials. The Chebyshev polynomial of order n (denoted as Tn (x)) goes through the range 1... + 1 exactly n times as the input x goes through the domain 1... + 1. Figure 2 illustrates this. Often when discussing Chebyshev polynomials, one considers only the domain 1... + 1, outside this domain, they diverge to plus or minus innity. In the context of waveshaping, Chebyshev polynomials have a further convenient property as opposed to the general polynomials, namely: when using a Chebyshev polynomial of order n as transfer function and using a unit amplitude sinusoid as input we will see only the n th harmonic in the output signal. For the general polynomial of order n we would have seen a combination of harmonics up to order n. When using linear combinations of Chebyshev polynomials, we can conveniently compose any desired combination of harmonics. Note, however, that the statement above does hold only for unit amplitude sinusoids - when the amplitude is not unity, we will see a combination of harmonics at the output of Chebyshev polynomials as well.

Symmetric Transfer Functions / Even and Odd Harmonics


When we look - for example - at the Chebyshev polynomials, we observe certain symmetries. The odd order polynomials possess a point-symmetry about the origin whereas the even order polynomials posses axial symmetry about the y-axis. In the former case, the identity f (x) = f (x) holds and this kind of symmetry is called odd symmetry in mathematics. In the latter case, the identity f (x) = f (x) holds and 2 article available at: www.rs-met.com

Intermodulation and Powerchords

WAVESHAPING

(a) T0 (x)

(b) T1 (x)

(c) T2 (x)

(d) T3 (x)

(e) T4 (x)

(f) T5 (x)

(g) T6 (x)

(h) T7 (x)

Figure 2: Chebyshev Polynomials of order 0 - 7 this kind of symmetry is called even symmetry. Such symmetries have implications on the harmonics which will be generated by our transfer function, namely: transfer functions with odd symmetry will create only odd order harmonics (frequencies at odd integer multiples of the input sinusoid) whereas transfer functions with even symmetry will create only even order harmonics. This statement holds for any function which possesses the respective symmetry, regardless of whether it is a polynomial or not. The hard clipper, for example has, odd symmetry and will create only odd harmonics therefore. A transfer function that does neither have even nor odd symmetry, will create even as well as odd harmonics in the output signal.

Intermodulation and Powerchords


Up to now, we considered the simple case where the input signal to the waveshaper is a pure sinusoid. Now we turn to the question what happens when the input signal is more complex, i.e. a sum of sinusoids. The simplest case here would be a sum of just two sinusoids. What could be expected is that the output signal contains the harmonics for both of the input sinusoids - which is true. However, this is only half of the story. In addition to these two harmonic series, we will also see sum- and dierence-frequencies. To see what this means, lets consider once more the simple quadratic polynomial y = f (x) = x2 as transfer function, but this time we choose as input signal x(t) the sum of two sinusoids with radian frequencies 1 , 2 and amplitudes A1 , A2 : x(t) = A1 sin(1 t) + A2 sin(2 t), so we have: y(t) = A1 sin(1 t) + A2 sin(2 t) = A2 sin2 (1 t) + A2 sin2 (2 t) + 2A1 A2 sin(1 t) sin(2 t) 1 2
2

(4)

article available at: www.rs-met.com

Intermodulation and Powerchords

WAVESHAPING

The rst two terms are of the same form as in equation 2, hence, they will create the DC components and components at 21 and 22 as before. The third term, however, represents a new phenomenon. To see the frequency components, which are created by this term, we need a further trigonometric identity: sin() sin() = 1 cos( ) cos( + ) . Using this identity and simplifying, we obtain: 2 y(t) = A2 A 2 A2 A 2 1 1 cos(21 t) + 2 2 cos(22 t) + A1 A2 cos (1 2 ) t A1 A2 cos (1 + 2 ) t 2 2 2 2
d s

(5)

where s and d are the sum- and dierence-frequencies respectively. As a concrete example, let the frequencies of our two sinusoids are 1000Hz and 300Hz and the amplitudes both be unity. According to the math, the output signal of the squarer contains DC with unit amplitude, 2kHz and 600Hz both with 1 amplitude 2 and 1300Hz and 700Hz with unit amplitude. For a more complex mix of sinusoids at the input and more complex transfer functions, even more of such cross-terms would appear. When this mix of sinusoids at the input is itself a periodic signal (a sum of sinusoids at integer multiples of some fundamental frequency), then those cross-terms will appear at integer multiples of the fundamental and thus coincide (frequency-wise) with the harmonics which are already there. In this case, we will only modify the relative amplitudes of the harmonics but not create something qualitatively new. But when we pass - for example - a chord through a waveshaper, containing the prime, the third and the fth (each with its own harmonic series) - we usually see (or hear) an incomprehensible spectral mess at the waveshapers output, due to the various sum- and dierencetones. If only the fth is present, the result does still sound rather good. Guitarists are familiar with this phenomenon and thats why they rarely play full chords over a distorted amp - powerchords usually contain only the fth, anything else would be too weakly related with the basic pitch and result in muddy output signal.

article available at: www.rs-met.com

You might also like