Everything you wanted to know about waveforms…

If you make music, I can’t imagine it’s too much of an assumption to say you probably know what sound is, right? Sound, that stuff that turns what would otherwise be an ordinary scene into a heartbreaking tearjerker or incredible hair-stand-on-ender; it’s the stuff that can make you go from sulking into your drink in the corner into wanting to get up on the dance floor and shake your booty.

And that’s just the music part of sound, before we even get into all the mundane parts like talking, or trying to pinpoint a bluebottle when you’ve just put out your afternoon tea selection.

When you get right down to it though, it’s just vibrating molecules. That music that got you onto your feet in the club: in the end it comes down to a cone of paper shaking a mixture of nitrogen, oxygen, argon, carbon dioxide and a few other gases until the vibration reaches your ear. But there’s a lot those vibrations can do, and there’s a lot you can do with them…

Good vibrations

If you’re into your synthesis, you’ll already be familiar with different waveform shapes such as triangle, square and sawtooth, but this beautifully made tutorial makes visualising the basic building blocks of sound wonderfully easy.

Via the wonderful world of the JavaScript-driven web, you can get hands on with frequency, phase, harmonics and all those things that you either love, or have been desperately trying to block from your mind since you escaped physics at high school.

Do it yourself

Maybe you want to investigate the fundamentals of sound yourself. If you do, you could take a look at the really rather interesting seewave package for R. This package has everything you need to synthesise the fundamental building blocks of sound and see what they get up to when you’re not looking (we’ve popped the code at the bottom of this post if you want to try it yourself).

Let’s take a quick look at what happens when we look at three simple waves: a sine wave of 2 Hz, a square wave of 2 Hz and a sine wave of 3 Hz. If we plot them (index on the x axis refers to each sampling point, sampling at 22050 Hz), we can see:

Our 2Hz sine wave:Our 2Hz square wave:And our 3Hz sine wave:Things get interesting when we add the two sine waves together though:You can see that adding the two sine waves of different frequencies gave us a whole new waveshape, but what does that mean for how these waveforms will sound? Let’s plot some spectrograms to get a feel for the sort of harmonic content that’s in there. For these plots, I’ve used frequencies of 2 kHz and 3 kHz to make things a bit more easy to see.

Looking at the 2 kHz sine wave, we can see the characteristically boring frequency content consisting of nothing but the fundamental:

The 2 kHz square wave gives us all those harmonics to give our filters something to chew on:

And the 2 kHz sine plus the 3 kHz sine? That gives us, well, what you might expect really: two strong bands at 2 kHz and 3 kHz. What this starts to illustrate though, is that by combining sine waves of different frequencies, and different intensities of course, can give you absolute control over the harmonic content of your synthesised sounds.

Getting stuck into the fundamentals of the basic properties of waves and how they interact is not only very interesting, it can also help with your synth programming, so go ahead and have a play with the waveforms tutorial, and go forth and synthesise!