You are on page 1of 15

# Generating Guitar Distortion using Analogue and

Digital Technologies
In musical terms, the output of an electric guitar is not very interesting there
is little variation in tone and the notes die away quickly. Most guitar players
use some form of effects unit to enhance the sound, either analogue or Digital
distortion to the sound of an electric guitar using both analogue and digital
technologies.

One of the best-known guitar distortion effects is fuzz, which is widely used by
rock and heavy metal guitar players. A typical fuzz circuit is shown in Schematic 1.

Schematic 1: Fuzz.

D1

D2

R2

100k

C1 U1
R1
Input
100nF
100k Output

For small input signals (less than about 0.7V), the diodes D1 and D2 will not be
turned on, and therefore have no effect. The operational amplifier U1 is connected as
an inverting amplifier, the gain of which is R2/R1 = 100k / 100k = 1. So, for input
signals less than 0.7V, the output will have the same magnitude as the input.

However, for inputs greater than 0.7V, the output will be greater than the forward
voltage of the diodes D1 and D2, so the diodes will conduct. The overall effect is that
the output is limited (clipped) between +0.7V and 0.7V.

If we were to apply a 1 kHz pure tone to the Fuzz circuit, the output would be as
shown in Figure 1.

## Figure 1. Input and Fuzz Output

From Figure 1 it can be seen that the fuzz circuit has distorted the shape of the
waveform. This leads us to a very simple definition of distortion - what comes out
is not what went in.

What does fuzz actually sound like? It is the distortion you hear on a walkman /
portable CD player when the batteries are going flat or when the volume is turned up
too much. There is not enough battery voltage to allow for the full output swing of the
amplifier on loud notes, so clipping occurs

Frequency Content

To explain the difference in sound between the input and output signals in Figure 1,
let us look at their frequency content. Figure 2 shows what would be seen if the pure
tone input and fuzz output were fed into a spectrum analyser.

## Figure 2. Frequency Content of Input and Fuzz Output

The horizontal axes in Figure 2 show the frequencies present in kHz. Here 0
represents 0 Hz (DC), 1 represents 1 kHz, 2 represents 2 kHz etc..

## A pure tone is by definition monotonous it only contains a single frequency. The

Frequency Content of a Pure Tone Input (top trace in Figure 1) contains only one
frequency - 1 kHz. The other outputs at 0 Hz (DC), 2 kHz, 3 kHz etc. are all zero.

Compare this with the Frequency Content of Fuzz Output (bottom trace in Figure 2).
Not only is there the original input at 1 kHz, there are also additional components at 3
kHz, 5 kHz, 7 kHz, 9 kHz etc. The fuzz circuitry has distorted the input waveform
to add extra tones that were not present in the input signal

The output of the fuzz circuit does not have any component at 0 Hz (DC). This is
important. Because the analogue circuit has two diodes, D1 and D2, the output is
clipped in both negative and positive directions. The average of the output will be
zero hence no 0 Hz (DC) component. If you were to build the circuit in Schematic 1
with only one diode, then the output would have a DC component. This would not

Enough theory for now! What does this all actually mean in terms of sound?

## As a consequence of the additional frequency components, fuzz will sound sharper

than the original pure tone. It also has more treble than the original, going right up to
20kHz. The high frequencies can be annoying because these notes are outside the
range of a guitar.

It is not possible to use fuzz with an electric guitar all night long it is too raucous.
We need a more subtle approach that is more pleasing to the ear.
Valve (Tube) Amplifiers

When an amplifier with bipolar transistors or FETs is overdriven, the output will be
clipped in the same way as fuzz. However, a classic guitar amplifier such as a
Fender / Marshall with thermionic valves (tubes) behaves in a different way when
overdriven. The sort of output you would obtain from a valve (tube) amplifier is
shown in Figure 3.

## Figure 3. Effect of Valve (Tube) Amplifier

The Valve (Tube) Sound Output waveform in Figure 3 has become squarer, but there
are no sharp corners. From the Frequency Content, it can be seen that there are
additional tones at 3 kHz and 5 kHz, but not higher. The high frequencies that are
annoying with fuzz are not present. This is much more pleasing to the ear.

Transfer Functions

In Figure 1 and Figure 3 we saw how Fuzz and Valve (Tube) amplifiers behave. For
both of these, we can draw the relationship between the input and the output on a
graph. This is shown in Figure 4.

## Figure 4. Transfer Functions of Fuzz and Valve (Tube) Amplifiers

The phrase transfer function simply means the mathematical relationship between
input and output of our system. The transfer function may be very simple the
output is the same as the input. Alternately, the transfer function may be a
complicated mathematical expression. In either case, the transfer function can be
drawn on a graph.

Let us look at the graph entitled Transfer Function for Fuzz in Figure 4. For inputs
less than 0.7V, the output is exactly the same as the input. So, if the input is 0.5V, the
output will be 0.5V. The relationship between input and output follows a straight line
and is said to be linear. For any input greater than 0.7V, the output will always be
limited to 0.7V.

In terms of the effect on sound, fuzz has no effect on small input signals. However,
for inputs over 0.7V, the output is always clipped to 0.7V. For these loud notes,
musical information above 0.7V will be lost. This makes all loud notes sound the
same.

Now let us look at the Transfer Function for Valve (Tube) Amplifier in Figure 4.
The graph of input / output follows a smooth curve. It is said to be non-linear
because we cannot represent it as a simple straight line. If the input is 0.5V, the output
will be 0.8V.

Again, what does this mean in terms of sound? At low levels, the output is boosted,
which makes the guitar more sensitive. At high levels, musical information is not lost
it is simply compressed (squashed). Unlike fuzz, the distortion effect works for all
input levels.

Sustain

One of the problems with a guitar is that the notes on the treble strings die away much
more quickly than those on the bass strings. The length of time a note lasts is called its
sustain. Instruments such as organs have very long sustain - as long as the key is
pressed, the note sounds. This is not true for guitars.

A useful side effect of the valve (tube) sound is that it improves the sustain of the
guitar signal.

When a string is plucked, the note from the guitar is very short lived. In Figure 5 it
can be seen that Note Played on Guitar (top trace) has a large initial value, but
dies away quickly.
Figure 5. Sustain Introduced by a Value (Tube) Amplifier

Putting the input through the curved transfer function of the valve (tube) amplifier in
Figure 4 compresses (squashes) the waveform. In Figure 5, it can be seen that the
Sustain Effect of Valve (Tube) Sound causes the notes to die away more slowly,
making the notes last longer. The only negative is that there is some distortion when
the note is first played. Interestingly, this is the same technique that is used in
telephones to compress the sound.

Overdrive

By changing the shape of the transfer function, we can add even more distortion to the
output signal. Notice how the Transfer Function for Overdrive in Figure 6 bends back
on itself. If we apply the same pure tone input, the output will be as shown in
Overdrive Output.

Figure 6. Overdrive
In the Frequency Content graph of Figure 6, the 1 kHz tone will still be there, but
there will be an even greater contribution at 3kHz. In other words, there will be more
distortion than input signal! It also tends to be unstable because more comes out than
goes in. This is the one to use with your electric guitar to hurt your ears.

## Implementing the Valve (Tube) Sound using Analogue

components

One way in which to generate the valve (tube) sound is to use a series of resistors and
diodes, as shown in Schematic 2.
Schematic 2. Valve (Tube) Sound using Analogue Components

D7 D8 D9

D5 D6

D3 D4

D2

## D1 100k 47k 22k

R3
R4 R5
R2

100k

C1 U1
R1
Input
100nF
100k Output

This is a similar configuration to the Fuzz circuit in Schematic 1, but with additional
feedback resistors R3, R4 and R5. Feedback resistor R3 will take effect when the
input is greater than 0.7V. Additionally, feedback resistor R4 will take effect when the
input is greater than 1.4V. When the input exceeds 2.1V, the feedback resistor R5 will
also be switched into the circuit.

So, as the input gets larger, more and more diodes will switch on and the
feedback resistors R3, R4 and R5 take effect to reduce the gain.

The major disadvantage of such as scheme is that in order to change the sound, it
means adjusting a number of resistors.

## Implementing Distortion Effects Digitally

Many guitar effects units and amplifiers now use Digital Signal Processors (DSP) as
the basis for sound processing. This makes it possible to adjust the sound using
software rather than having to change analogue components.

Fuzz, valve (tube) sound and overdrive do not take a great deal of processing in C
code and can also be implemented on a microcontroller with 8-bit capability.

Fuzz in C Code

Example 1. Fuzz

float input;
float output;

## if ( input > 0.7)

{
output = 0.7;
}
else if ( input < -0.7)
{
output = -0.7;
}
else
{
output = input;
}

The code in Example 1 does the same as the circuit in Schematic 1. If the input is
greater than 0.7V, the output is limited to 0.7V. If the input is less than 0.7V, then the
output is limited to 0.7V. For small inputs, the output is the same as the input.

## Valve (Tube) Sound and Overdrive in C Code

The easiest way to implement the Transfer Function for Valve (Tube) Sound in Figure
4 is to use simple mathematics. We can use an equation of the form y = ax + bx2. Here
x is the input, and y is the output. Example 2 shows how to implement the curved
transfer function in Figure 4, which is y = 2*x - 1*x2

#define a 2.000
#define b 1.000

float input;
float output;

## if ( input >= 0.0 )

{
output = a * input - b * input * input;
}
else
{
output = a * input + b * input * input;
}

For positive inputs, we have to use b, but for negative inputs we use +b.
To generate overdrive, as shown in Figure 6, we simply change the values of the
coefficients a and b:

Example 3. Overdrive

#define a 4.000
#define b 4.000

float input;
float output;

## if ( input >= 0.0 )

{
output = a * input - b * input * input;
}
else
{
output = a * input + b * input * input;
}

## In practice, a guitar effects processor will take an input from an analogue-to-digital

converter (ADC), typically in the range 16 to 24 bits. We shall assume that the ADC is
16-bits, so the inputs will be in the range 32767 to +32767.

There are two types of DSP chips. Floating- point processors can handle numbers
with decimal points e.g. 0.8123. On the other hand, fixed-point processors can only
handle whole numbers e.g. 8123.

## A function to implement fuzz and distortion on a floating-point processor such as the

Texas Instruments TMS320C6713 is shown below.

/*******************************************************/
/* fuzz() */
/*******************************************************/
/* Function takes an input in range 32767 to + 32767 */
/* from the ADC and limits the range */
/*******************************************************/

{
float input;
float output;
/* Convert ADC input to value between 1.00 and +1.00 */
input = (float) ADC_value / 32767.0;

## if ( input > 0.7)

{
output = 0.7;
}
else if ( input < -0.7)
{
output = -0.7;
}
else
{
output = input;
}

## /* Convert from 1.00 to 32767.0 */

return ( (int)(output * 32767.0)) ;
}

/*******************************************************/
/* valve_sound() */
/*******************************************************/
/* Function takes input in range 32767 to + 32767 and */
/* calculates the output from y = a*x + b*x*x where */
/* x = input from ADC and y = output */
/* Use different values of a and b to alter the effect */
/*******************************************************/

#define a 2.000
#define b 1.000

{
float input;
float output;

## /* Convert ADC input to value between 1.00 and +1.00 */

input = (float) ADC_value / 32767.0;

## if ( input >= 0.0 )

{
/* Positive input values */
output = a * input - b * input * input;
}
else
{
/* Negative input values */
output = a * input + b * input * input;
}
/* Convert from 1.00 to 32767.0 */
return ( (int)(output * 32767.0)) ;
}

Note that in both functions fuzz() and valve_sound(), the first step is to
divide the input by 32767. This means we are only working on numbers between
1.00 and + 1.00. This is deliberate. No matter how many multiplications we use, the
result will always be less than 1.000; we do not have to worry about overload.

## A function to implement fuzz and Valve ((Tube) Sound on a fixed-point processor

such as the Texas Instruments TMS320C5510 or a microcontroller with 16-bit
capabilities is shown below. If 32767 represents 1.000, then 22937 represents 0.7000.

## Fuzz is not particularly difficult to implement.

/*******************************************************/
/* fuzz() */
/*******************************************************/
/* Function takes input in range 32767 to + 32767 and */
/* limits the range 22937 to +22937 */
/*******************************************************/

{
int output;

## if ( ADC_value > LIMIT)

{
output = LIMIT;
}
else if ( ADC_value < -LIMIT)
{
output = -LIMIT;
}
else
{
}

return (output);

}
However, distortion is more difficult to implement on a fixed-point processor. We
cannot easily represent fractions. In this case we use 16383 to represent 1.000.
Several shifts are required to scale the values.

/*******************************************************/
/* valve_sound() */
/*******************************************************/
/* Function takes input in range 32767 to + 32767 and */
/* calculates the output from y = a*x + b*x*x where */
/* x = input from ADC and y = output */
/* Use different values of a and b to alter the effect */
/*******************************************************/

## int valve_sound( int ADC_value, int a, int b)

{
long input;
long output; /* 32-bits */

if ( input >= 0 )
{
/* Positive input values */

## output += (input * a);

}
else
{
/* Negative input values */

}

## /* Convert output from 32-bits to 16 bits */

return ( (int)(output >> 14)) ;
}

## In this case, a digital signal processor (DSP) is preferred to a microcontroller because

it has 32-bit capabilities and built-in shifts.
Conclusion

We have seen how to alter the sound of an electric guitar by distorting the shape of
the waveform in two ways. The first is to use fuzz to clip the waveform and the
second is to simulate the effect of a valve (tube) amplifier using a non-linear transfer
function.

These distortion effects add extra tones to the output that were not present in the
input. As a side effect, the sustain of the notes played is improved.

It is easy to see why digital technology, in particular Digital Signal Processor (DSP)
devices are popular for modern guitar effects units they give more flexibility than
can be achieved using analogue components, especially where we want the effects to