Harmonics

Harmonics

Different waveforms sound different.  A sine wave sounds different than a square wave, which sounds different than the waveform that comes out of an accordion.   All these waves have unique timbres because they have different harmonic content.

A harmonic is basically a multiple of a fundamental frequency.  For example, let’s say you’re playing a note with a frequency of 100Hz.  That would be the 1st harmonic.

Fundamental (First Harmonic): 100Hz

 

The 2nd harmonic would be twice that frequency, or 200Hz.

Second Harmonic: 200Hz

 

The 3rd harmonic would be 3  times the fundamental, or 300Hz.

Third Harmonic: 300Hz

 

You can see that it’s pretty easy to figure out the 4th, 5th 6th, etc.

Now let’s do some frequency analysis of our different waveforms to see why they sound the way they do.  We’ll start with the sine wave:

Sine Wave Spectrum Analysis

 

In the spectrum analyzer display above, the horizontal axis (x) is frequency and the vertical axis (y) is level.  What it’s telling us is how much energy the signal has at various frequencies.  In the case of our sine wave, you can see that there is a single spike right at 100Hz.  That’s pretty much what we expect to see since it’s a 100Hz tone.

Now let’s look at a sawtooth:

Sawtooth Wave Spectrum Analysis

 

Notice that the sawtooth not only gives us a spike at the fundamental frequency, there are also some smaller spikes at each harmonic frequency going up (200Hz, 300Hz, 400Hz, etc.)  The triangle wave contains the fundamental and a whole series of harmonics, which explains why it sounds so much different than a sine wave.

Now let’s check out a triangle wave:

Triangle Wave Spectrum Analysis

 

Once again we have several spikes, but this time they’re only at the odd-numbered harmonics (3rd=300Hz, 5th=500Hz, etc.).

Here’s what a square wave looks like:

Square Wave Spectrum Analysis

 

Like the triangle wave, the square wave contains odd harmonics, but they fall off less rapidly as the frequency increases.

Waveforms tend not to contain even harmonics if they are vertically symmetrical.  The square and triangle waves above are perfectly mirrored above and below the horizontal center line, so they don’t have any even harmonics.  The sawtooth, on the other hand, is lopsided and does contain even harmonics.  This rule of thumb applies to other waveforms too.

Figuring out what sine waves make up a more complex wave is called Fourier analysis. You don’t have to know anything about it to patch synthesizers, but it’s interesting stuff.

Why do different waveforms contain different frequencies, even though they’re basically just a single frequency?  Let’s explore that.  Remember our sine wave?  It only contained its fundamental frequency with no additional harmonics.  A sine wave is a pure tone and can be used as a basic building block to create other wave shapes.    You can get just about any waveform you want by adding a series of sine waves at the correct frequency, amplitude and phase.

Let’s mix 3 sine waves together, 1 fundamental and two odd harmonics with descending amplitude, and see what we get.  Note that when you mix (add) waves you end up with another single wave rather than what looks like two waves on top of each other.  This is because each wave is pushing or pulling on the same medium (your eardrum, the voltage in a wire, a digitally stored value; it doesn’t matter).  The values of each wave add at every point along the wave.  Adding two identical waves will give you a wave with the same frequency but twice the amplitude.  Two identical waves that are 180° out of phase (the positive peaks of one line up with the negative peaks of the other) will add to 0 at all points and cancel each other out.

Here are the source waves that we’ll be mixing (click to enlarge):

Sine Wave- Frequency:100Hz Amplitude:60%Sine Wave- Frequency:300Hz Amplitude:50%Sine Wave- Frequency:500Hz Amplitude:40%

 

 

 

Here is what they look like mixed together (with some minor gain adjustments to prevent clipping):

3 Waves Mixed Together

 

Notice that they’re starting to resemble a square wave?  If we kept adding more and more sine waves at just the right frequencies, phases and amplitudes we would get closer and closer to a perfect square wave.

Waves don’t always have to have spikes at frequencies that are even multiples of the fundamental.  Sometimes they’re in-between or they appear seemingly at random.  These types of waves are considered to be inharmonic.  Because the spikes don’t fall at musical intervals, inharmonic waves can sound quite dissonant (like a cymbal).  Just a touch of inharmonicity can actually add “warmth” to a sound, as in the case of a piano.

We’ve been looking at some very basic waves which don’t often exist in nature.  The ability to generate these waves with a synthesizer means you can create a vast array of sounds that would be difficult to replicate without the use of electronics.  Acoustic instruments, on the other hand, tend to produce waves that are far more complex.  This is why it’s tough to create a patch that accurately mimics a piano, guitar or trumpet.

 

 

Did you find this article useful, interesting or informative? Why not share it?

 

2 Responses to “Harmonics”

  1. saumya says:

    really a nice site to learn abot the wave harmonics.good work.

  2. Corbin says:

    I know that a square has exactly half as many harmonics as a saw wave. Does a triangle wave share this relationship with another wave?

Leave a Reply