Okay, so now it's time to listen to the demonstration.

In this Matlab demonstration, I've simulated the kind of non-linearity that

we were just talking about for the op amp circuit with diode feedback.

Now, what I've done here is to start off, let me just run this once.

[NOISE] Now, what I've done is I've modeled a non-linearity of the sort that

we were just describing. So if you -- this is the output versus

the input of the op amp. And so the blue line is just a linear

Output-input relationship. So that's if there was no distortion at

all or no compression. Now, the red line is the non-linearity

that we've that we're modeling in this case.

So what this shows is that near 0, just as in the curves on the previous few

graphs, you see the slope is quite steep, so there's a lot of gain near 0.

But then as the input signal becomes larger, moving up the curve this way, the

output does not continue to go up as fast and the gain actually rolls off to less

than one. And, of course this is set up so it's

symmetric, so it does the same thing the negative Now, it's just an interesting

aside. Vacuum tubes aren't necessarily

symmetric, so the in fact, they're not symmetric, and, in their distortion

characteristics. And so, this diode circuit that we're,

that we've built into the guitar amplifier is sort of an approximation of

what you get with a tube amplifier, but there are differences.

So anyway, in the simulation. I take this red input/output

characteristic. And then we run just a sine wave through

it. So here's the original sine wave.

Two cycles of 440 hertz. And this is the distorted output.

So I just, every point on this sine wave. You look up where that is on the input,

and then you just read off what the output would be.

And so if you do a point-bypoint mapping of the sine wave using the red transfer

characteristic you'd get the red output signal here.

And then, finally, down below I plotted the spectrogram of the original signal.

So this is a 440 hertz sine wave. So remember back when we were talking

about spectrograms. This is the time axis along here, so it's

one second worth of. Sounds that you heard and the frequency

axis I'm only going up to 11,025 hertz in, in this spectral analysis.

But in the original pure sine wave there is a single strong component at 440

hertz. And then in the distorted sign wave

there's that same component at 4 40 plus all of the harmonics and in fact these

are the odd harmonics. So it's 4 40 and whatever 3 times 440 is

so you do the math and then 5 times 440 is 2200.

So, here's 2200 and so on and so forth. And so you get all of these on harmonics

making up this distorted wave form. Now let's listen to that again.

[NOISE] Okay, now I'm going to take and make the non-linearity less extreme.

So I want the parameters over here, I just have to change them a bit.

[NOISE] So let me go further. Make it almost linear.

[SOUND] So you see the output doesn't have that, as much of an S shape to it

and the distorted output wave is not as sharp near the zero crossings.

And there's not as much power up here in the higher harmonics either.

So let's listen to that and then I'll turn up the distortion in steps to get

back to where we started.

[SOUND]

Go up some. [SOUND] I'm going to go up a little more.

[NOISE] I'll go up one more notch, see what happens.

[NOISE] Okay, so it's just more of the same.

Now, with this same Matlab program I can also read in a short clip of a wave file.

And then apply the distortion to that same file.

So, this is about three or four seconds of a guitar sound that we used a couple

of weeks ago. So let's run that through.

[MUSIC] So, there's the spectrogram of the original waveform.

Now that already had a lot of harmonic overtone structure to it, but by running

it through the distortion, that really accentuated that quite a bit, and that's

what you're hearing. So let's also just take, and for fun

let's zoom in on the end of here. So here's the more or less Sinusoidal.

So this is what has happened to that signal.

This is more or less the same place. In fact you see those two peaks?

That looks like it's those two. So there's the original and the

distorted. So let's listen to that once more.

[SOUND] Okay, so this actually is, this simulation is a fairly close facsimile to

what you should hear after you build the amplifier and turn up the gain control

knob, turn up the distortion.