One of the things that I love about exploring digital signal processing
and synthesis is you really don't need a teacher.
You don't need me at all.
You can set up experiments and you can figure it all out on your own.
We have analyzers, and we have signal generators,
and we can really figure out how things work.
And what I want to do here is show you how
I approach working with a new device.
And really, what we're going to be looking at
is distortion and filtering, and their impact on wave shape and frequency.
So when we were talking about delay, it was very curious
how small delay times interacted with the frequency spectrum.
It was kind of unexpected that a small delay would actually
end up being a filter.
And this is another one of those things we
try to relate wave shape, the shape of the waveform,
that synthesizer shape that we have, and we try to relate that to the frequency
spectrum, lows to highs, and how that functions, how
they interrelate with each other.
And to figure this out, I've created a couple Max for Live devices
that are going to be really useful.
One of them is an oscilloscope.
Now, an oscilloscope is a standard scientific measurement device.
It allows us to visualize a waveform.
The idea with an oscilloscope is it has time
horizontally and amplitude vertically.
And you put a signal into it, and it'll display that signal.
The challenge with that is signals, as we know, are moving by very, very fast.
And in fact, I'm going to put through this oscilloscope a 100-Hertz sine
wave.
So that's happening 100 times per second.
For the oscilloscope to view that short amount of time,
it needs to set its window to 100 milliseconds
and also restart the view every time the signal goes vertically,
every time it crosses zero.
And that's how an oscilloscope works, and we have one right here.
I've built it just by taking bits of Ableton Max for Live patches
and repurposing them for this class.
Right now, I've set the view how we need it to be,
and I'll turn up this amplifier.
And we see the sine wave right here.
I can also see if I change the frequency of this-- so right now, it's 100 Hertz.
But if I was to raise this up or down, if I raise it up,
we see that we have more cycles per second.
That waveform shrinks up.
Or if I lower the frequency, we're going to see that that waveform gets
longer and longer.
So as you work with an oscilloscope, you're
going to have to dial in these numbers a little bit.
You'll have to find a place where it kind of is stable.
For any of these signals that are in the audio range,
what I might call high frequency as opposed to low frequency-- right?
I might have an LFO, a low frequency oscillator,
which means below hearing range, below, say, 20 Hertz.
Or I have a high frequency signal maybe inside of the hearing range,
between 20 Hertz and 20,000 Hertz.
Anything that's in that hearing range, I want to turn off this low button.
That's a low resolution button.
It's best if you're viewing very, very slow signals.
I'll turn that off.
And I'll set my oscilloscope really just by eye until it kind of stops moving.
I also might have to adjust the trigger, which adjusts where
it restarts that view over and over.
Once you get those dialed in, you'll be able to see
a clear picture of the waveform.
Now, this is going to work best with very simple waveforms.
As they get complex, as they have delay, as they have reverb,
the oscilloscope's not going to be able to accurately trigger.
It's not really going to be useful.
So think of it like this scientific analysis device.
Now, my goal is to analyze another device that I created.
I called it Simplest Function.
And we're just going to try to figure out what this thing does.
And in the end, we'll find that a lot of distortions work the same exact way,
but our goal is to figure this thing out.
So I'm using one view, which is an oscilloscope.
And the other view I'm using is the Spectrum Analyzer.
And the Spectrum device is built into Ableton Live.
It's just called Spectrum, and I've place it after the oscilloscope,
and I've opened up its large view.
Now, by default, it will automatically rescale its range,
and I don't think it's going to be useful for us.
So I'm going to change a couple of settings inside Spectrum
that I'd like you to copy as you're trying this on your own.
We're going to set the range out of Auto Mode,
to be from zero as a max to negative 50 as its range.
All right, that's going to be the main one.
I want to make sure that it's a logarithmic view,
and you can copy the rest of these settings.
I would prefer to make this my default, so every time I opened up Spectrum,
it had these settings.
I find that most useful.
So if I control click or right click on the title of Spectrum,
I'll have an option to save it as the default preset.
That way, every time I open up Spectrum from then on,
I'll get this exact setting, and I'll have a consistent picture of my sound
every time.
It's going to make it easier for me to associate the spectrums
of different sounds if I have that consistent picture every time
I open up the device.
So what we're seeing here, we can think of the oscilloscope
as showing the time domain, and the Spectrum Analyzer
to be showing the frequency domain.
So the oscilloscope shows time left and right, amplitude vertically.
The Spectrum Analyzer shows frequency left to right and amplitude vertically.
And so our question is, as I start manipulating the wave shape,
how does the spectrum change?
Let's try it out.
So I'm putting a 100-Hertz sine wave through Simplest Function,
the device I made.
And I'm adjusting my amplitude so that it's
pretty much filling the oscilloscope.
And I'm going to adjust the oscilloscope time range here
until I'm seeing a little bit more than a single cycle of the waveform.
Let's just try it and see what happens.
I can add points in here, and I can move things around, and I can recurve them,
and let's see what happens.
So I'll put a point right in the middle, then I'll grab this top one,
and I'll bring it down a bit, and let go.
And we can see two things happen.
One, the wave shape changed.
Nothing changed in the bottom half of it.
It stays a perfect curve in the bottom half.
But the top half has shrunk.
And we also see that we've added a bunch of vertical lines
in the spectrum analyzer, and we've heard that the sound gets richer.
Let me try something else.
I will now put a dot there and see what we have.
Oh, now, I've made a kind of line in the middle of it, and I get this odd shape.
Hopefully, you're starting to think and starting
to see how this function is controlling the wave shape,
and we actually hear that the sound, again,
became more complex, a little richer.
And we're also seeing different sets of harmonics pop up,
but they're all in the same place.
So let's try this.
Now, let me move these around.
So if we look at the Spectrum Analyzer and I
start shifting these dots around--
and I can turn snapping off on the function here so I can do this easier--
move this down.
Really rich.
We get lots of upper harmonics, but we're seeing--
and if I click in the Spectrum Analyzer, it'll reset it.
I'm seeing we have these specific peaks.
And if I move this around, the peaks don't move left to right,
but they do move up and down.
My wave shape is changing drastically, but those peaks
are all in the same exact location.
So what's happening here?
We're seeing that as I manipulate the wave shape,
I'm changing the amplitudes of the various partials that
are above the fundamental frequency.
So that's a lot of these words that we've been struggling with
and we'll continue to struggle with over the rest of the class.
Our fundamental frequency is going to be that lowest peak that we have there.
We tend to call that the pitch, the pitch being
the perceived lowest partial.
Partials are all the different frequencies
that we actually have energy at.
And so we see I've stopped the sound, but we still
see a ghost trace of where each one of those was loudest.
And we see they're in a very particular organization.
The lowest one is at 100.
The one above that is at 200.
The one above that 300, 400, 500, 600, 700, et cetera.
In fact, all the partials, which are the actual measurable peaks,
are in an exact harmonic series.
We might even call these harmonics, but that's a bit of one
of these weird words, right?
A harmonic and a harmonic series is a mathematical ideal,
what we would have in a frictionless perfect environment like a computer.
What we actually hear are partials.
And often, the partials are not perfectly aligned
with a harmonic series, particularly when we
have a real instrument, like a piano.
If you play a piano note, you'll notice that those partials,
the peaks aren't perfectly in a harmonic series.
They're a little bit out of that which gives the piano its unique rich tone,
its unique rich timbre.
And it's also why it's hard to create piano sounds with a synthesizer,
because any looped waveform, all of its partials, where we actually
have that energy, is going to absolutely be in a perfect harmonic series.
So synthesizers have a limit to what they can accurately represent,
because when we loop a waveform, all the partials will always
be exactly in a harmonic series.
Every one of the partials will be an exact integer
multiple of the fundamental frequency.
I know that was a lot.
That's a hard chunk of words, and we'll just keep playing with it.
And when we look at physical modeling later and inharmonicity,
we'll see what happens when we take those partials out of the harmonic
series, when we get away from this.
But for now, let's just play with wave shape,
because it's actually really fun.
Let's see if we can figure out more about how this function device works.
If I turn up the amplitude beneath it, we're
going to see this funky wave shape.
And I'm going to hold Shift and get rid of some of these points
here and pull this up.
And what we have here is actually a transfer function.
We're actually showing input left and right on the bottom and output
vertically on the side.
And this line is telling us how input relates to output.
For every single value with input, there's exactly one value output.
If this line is at a 45-degree angle, then input
is going to equal output exactly, which what we have here
is like an equal sign.
As we start manipulating this, we'll start
changing the shape of that waveform, and then we'll,
in effect, be changing the timbre.
So now, we'll see how we can turn this into a typical distortion device.
With distortion, what we have is there's a certain threshold
where the sound starts to change.
But below that, it is perfectly the same.
What we really have is an area in the middle of the transfer function
that's a 45-degree angle, and then the areas outside of that
are somehow different.
And a very common type of distortion is this one.
I'll put a point there.
I'll make sure snapping is on.
I'll put a point right there.
I'll put another point here.
I can use shift-click to get rid of break points.
And then I'll start to curve some of the lines.
Like, I'll take this top one, and I'll bring it down a little bit.
I'll take snapping off.
We can see how that lopped off the top of the waveform.
I call that hard clipping.
I'm going to create soft clipping first, though.
Bring this up a little bit, then we'll curve this, and we'll go to this one
down here, and we'll curve that.
We actually call this soft clipping, the idea
being if I bring the gain down before this, if the sound is in the middle,
we call this the linear range.
It's alternating only in this range.
There's no distortion.
We get a sine wave on the output, that portion of the transfer function that
is 45 degrees and input equals output.
As I increase the gain before my distortion device,
there'll be a point where that sine wave is
going to hit that portion of the transfer curve that's curved,
and the wave shape's going to change.
And as I do that, as I bring the level up, what's happening
is the sound's getting richer.
We're getting into this portion where it's no longer input equals output.
We're changing the wave shape, and we're seeing these upper harmonics start
to form.
In effect, I like to think of this as we increase the gain before a distortion
device, the energy can't go up any more.
It just gets spread out among the upper harmonics.
So the louder the signal, the brighter the timbre.
And that might be a good way to think about distortion.
It turns volume variations into timbre variations.
As they get louder, go into the distortion,
we get more upper harmonics.
That shape of the transfer function determines
which partials are actually going to be loud and which ones are quiet.
So as I bring this up higher, we're going
to see, oh, well that one really emphasized the third harmonic.
Now, if I have a different shape, it might emphasize a different harmonic.
And like I just changed it there, I created a little loop on the top of it,
and that would really emphasize the second.
And so the different wave shapers, these different transfer functions,
will give us different distortion characteristics.