Tube Amplifier Emulation (part 3 of 4)
How Can a Computer Do Emulation?


Part two discussed the purpose of tube amplifier emulation.

By now you understand why tube amplifiers are coveted by guitarists (though you might not be lining up for a membership to that cult). And you understand that playing a guitar through a tube amplifier can be expensive because the equipment isn’t cheap, nor is eviction.

The next piece of the puzzle is to understand that a laptop can be used as a substitute for a tube amplifier. Tube amplifiers typically use a few tubes, let’s say about 5 tubes. A modern laptop, for comparison, has about 2 billion transistors. And each one of those is a bit like a tube. End of the story.

Well, not quite actually. But it turns out that if you add an audio interface (costs around $100, and plugs right into a USB slot) to a laptop, you can use it as a guitar amplifier. And you can play it out of any speaker at any volume. And the amplification is nearly perfect! None of that pesky distortion… oh right, that distortion is what we’re after.

Audio Interface
An audio interface at work.

So then why not just get a bad audio interface that introduces imperfections? The issue is that it won’t result in the same distortion as that created by a tube amplifier. You could try to make it imperfect in a way that sounds like a tube amplifier (which is effectively what solid state amplifiers do). While this can work, you will get only so far trying to emulate a tube with a handful of transistors. But, what if you had 2 billion transistors to work with…

That’s the idea behind software emulation: instead of trying to get a handful of transistors to act like a tube, billions of transistors are used to evaluate mathematical formula, and those formula are designed to emulate the behaviour of a distorted tube.

Butterworth factor
An overly verbose example of a formula used in digital signal processing.

If that sounds needlessly complicated and roundabout, well it kind of is. But given the availability and versatility of laptops, it’s pretty convenient. And what’s more, a laptop isn’t limited to emulating a single amplifier. It can emulate pretty well any amplifier, and the speaker, and the microphone, and the engineer moving sliders around in the control room…

To summarize the discussion so far: laptops can amplify a guitar signal, they can also use their vast computational power to transform that signal, and such transformations can be used to emulate tube amplifiers.

An overly simple approach to emulating amplifier distortion might be to clip the signal above a certain level. It is known that this is sort of what tube distortion does. And it sort of works: the clipping introduces harmonics in the signal, making it fuzzy. But it’s definitely not quite “the same” fuzz that you get from an amplifier. And the fuzz is fairly static as it doesn't change much in response to changes in the guitar signal.

You can try this for yourself: enter the following code into the FAUST editor. The code generates a sine wave at 440.0 Hz (A4), splits it in two, keeps one version as is, and clips the other at 0.5.

FAUST clip code
A very very simple amplifier emulation algorithm in FAUST.

You can see the resulting clipped waveform in yellow, while the original signal is shown in pink. The original frequency spectrum (also shown in pink) has a single peak at the sine's frequency. After clipping, many new frequencies are introduced in the spectrum (shown in yellow), resulting in a loud fuzz.

Clipped sine wave
 
Clipped sine wave's FFT
The sine wave and frequency spectrum before and after clipping.

A more sophisticated approach to emulation involves measuring the frequency profile of harmonics created by an amplifier (this is known as an impulse response). This is the basis of modelling amps and ensures you get “the same” fuzz as that generated by the amplifier.

However impulse responses have a significant drawback: they capture only a snapshot of the amplifier's sound. That is to say that they capture the response of the amplifier to a signal at a particular level. The snapshot can't know how the distortion should change in response to signals at different levels. This is fine for heavily distorted metal tones since the signal becomes so compressed that its level hardly changes. But for most other guitar tones, this approach falls flat on its face since it causes signals at all levels to have the exact same distortion (i.e. the distortion can't clean up).

It's possible to capture multiple such snapshots and use post-processing to recover some of the dynamics of the amplifier. While this is certainly a valid approach, it isn't perfect and can be a bit inflexible.

Part four explains the approach taken in building Swanky Amp.