Select Page

Everything you wanted to know about waveforms…

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.

What is a waveform?

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…

Waveform ConvergenceGood 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:Sine WaveOur 2Hz square wave:Square WaveAnd our 3Hz sine wave:Sine Wave Plot using RThings get interesting when we add the two sine waves together though:Adding Sine Waves Together in RYou 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:

2k Sine Wave SpectrogramThe 2 kHz square wave gives us all those harmonics to give our filters something to chew on:

2k Square Wave SpectrogramAnd 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.

Additive Sine Wave SpectrogramGetting 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!

# load seewave library

# create 1 second-long waves using synth() function, sample frequency is 22050 Hz
sine2 <- synth(f = 22050, d = 1, cf = 2, signal = 'sine')
square2 <- synth(f = 22050, d = 1, cf = 2, signal = 'square')
sine3 <- synth(f = 22050, d = 1, cf = 3, signal = 'sine')

# plot waves

# add the two sine waves together
sineAdd <- sine2 + sine3

# plot additive wave

# create more audible group of sine waves, sample frequency is 22050 Hz
sine2k <- synth(f = 22050, d = 1, cf = 2000, signal = 'sine')
square2k <- synth(f = 22050, d = 1, cf = 2000, signal = 'square')
sine3k <- synth(f = 22050, d = 1, cf = 3000, signal = 'sine')

# add the two sine waves together
sineAdd2 <- sine2k + sine3k

# plot spectrogram

About The Author

Red Dog Music

Dawsons Music is delighted to announce that the Red Dog Music brand is now part of the Dawsons family. This is an exciting opportunity to bring both communities together and create a stronger, wider network of people passionate about music gear. We both share a common heritage to support musicians throughout the UK and Dawsons want to support Red Dog Music customers in their continued musical journey.

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.