In this blog, I'm going to give a quick introduction into how additive synthesis works, introduce the concepts of the time and frequency domains, then work to create a time domain square wave using additive synthesis to show that a time domain square wave is really a sum of its parts.

Additive synthesis generates sound by summing one or more sine waves into a final output.  Each of these sine waves contribute their portion to the overall sound produced.  When creating sine wave oscillators for additive synthesis, many variables can be controlled to change the behavior of a sound, such as amplitude and frequency modulations - on a per partial basis, given that the compute platform can handle it.

Time and Frequency Domains

The time and frequency domains of a signal can be thought of as two different representations of the same thing.  The time domain reflects the state of some variable as it changes over time.  The frequency domain view of the same signal shows hidden behavior not visible in the time domain, by showing us the frequency content of that signal.  Using Fourier Analysis, we can switch between the time domain and frequency domains of a signal.  No worries, you don't need any math here.

For example, in the plot below, the top image shows a 1.0 KHz sine wave oscillating over the course of 0.02 seconds.  This is the time domain view of the signal which is what most of us are familiar with.  The bottom image shows the frequency domain view of the signal, after applying something called an FFT to the time domain signal.  The x axis units of the frequency plot are in Hz and shows the energy present in the signal at each frequency.  The y axis units are in decibels, which is a logarithmic scale. The frequency domain of a sine wave signal shows a single spike at the frequency of the signal, in this case 1.0 KHz.  There is almost no other energy in the signal at other frequencies except for a small amount of noise added to make these plots easier to view.

Recall that the human ear hears in the frequency domain, not the time domain.  (Please read the Additive Synthesis page on our site for more details if you haven't seen it).  Since we hear in the frequency domain, have a look at the frequency plot of the sine wave above: it makes sense that the sine wave is the cleanest, if not most uninteresting timbre signal generated by synthesizers.

The next plot below shows another sine wave, this time at 3 Khz.  Note that the frequency spectrum shows the energy at 3 KHz.  This signal is audibly higher in pitch than the 1 Khz tone.

Let's make a square wave!

Square waves are one of the most used oscillator shapes in musical subtractive synthesis.  It turns out that square waves are defined as having frequency harmonics at odd integers of the fundamental frequency, with an amplitude that decreases as the harmonics get higher in frequency. If 'F' is defined as the fundamental frequency (the note of the sound), then odd harmonics will fall at 3xF, 5xF, 7xF, 9xF etc.

If the note being played is 500 Hz for example (somewhere between a B4 and C5), a single sine wave will look like this:

If we add a second sine wave at 3 x 500 Hz (1500 Hz) and sum them together, it looks like the plot below.  Note that the top image shows each of the sine waves individually, the middle image shows the sum of the two sine waves (adding them together - additive synthesis), and the third image shows the frequency content of the summed signal - with two distinct frequencies at 500 Hz and 1500 Hz:

Adding a third partial, at 5 x 500 (2500 Hz):

The fourth partial:

Eight partials:

16 partials:

And finally 128 partials.  Note that for the below plot I had to decrease the fundamental frequency to 100 Hz to prevent frequency aliasing, which I can talk about in another post some day.  The more partials we add, the closer we get to generating a perfect square wave.

Analog enthusiasts may argue that a closer to perfect square wave can be generated in the time domain using analog circuitry (ie perfectly square corners in the time domain), it will sound better.  This is not fully true - the human ear is limited in the frequency bandwidth we can hear (up to 20KHz for some lucky people), so partials or harmonics within the signal greater than 15KHz or 20KHz just won't be picked up by the cochlea, so the brain doesn't get the message, and are irrelevant.

For very low note frequencies such as this 100 Hz note (~G2) below, more harmonics will fall into the human hearing range.  But for a higher pitch note such as the 500 Hz B4/C5 in the examples above, not many more than 16 partials will fall within the human hearing range and a perfect time domain signal won't sound any better.

Thanks for reading.  If you have any questions or have suggestions for blog entries, feel free to reach out!

Eric