The revisit to 'The 30dB Rule' got me thinking. I realised that there is a lot that most sources don't tell you about waveform displays. Now, if this was a YouTube video, I would be using an eye-catching picture and a bold primary colour headline like:

**'Hidden waveform secrets!'**

But this is a blog, and I'm not a great fan of the hyper-sensationalism that YouTube seems to encourage. Instead, I've decided to extend 'The 30 dB Rule Revisited' into a few parts, so that I can cover the topic in more detail. (and in even more detail in the next edition (4th) of my 'Sound Synthesis & Sampling' book)

### The Waveform

Let's start with the sort of diagram that normally appears in textbooks (or on Pianobook videos!) and build from that.

This diagram shows a single cycle of a sine wave: a 'sine' waveform. The time axis is horizontal, and the amplitude (posh word for volume, size, voltage...) is on the vertical axis. The convention is that you show the positive part first, starting with the first time that the waveform crosses the zero axis, and then the negative part, finishing with the third and final zero crossing. This is just a convention! You could start anywhere on the waveform if you wanted - the waveform doesn't care. But you do need to show at least one cycle, of course.

I normally try to avoid too much maths in this blog, but there's an important formula in the diagram: the relationship between Frequency and the time it takes to complete one whole cycle (this time is called the period, which harks back to pendulums and clocks and physics...). The formula is:

**Frequency = 1/Period**

Which can be clarified as:

**Frequency (in Hertz) = 1/Time to complete One Cycle of the waveform (in ms)**

For most audio signals (posh word for sounds, audio voltages...) then the time is usually conveniently measured in milliseconds (thousandths of a second) or microseconds (millionths of a second). Seconds are too big a unit of measurement for the short time that it takes for a sine wave to wobble. For example, a 50Hz mains electricity (in some countries) takes 0.02 seconds to complete one cycle, but it feels much easier to say 20 milliseconds (200ms). In countries where the mains frequency is 60Hz then it takes 16.666... milliseconds (or 0.0166666... seconds) to wobble up and down (or down and up - remember it doesn't matter!)

The formula means that as frequency goes up, then the period (time for one cycle) gets shorter. So a note of 440Hz (an 'A') would have a period of 2.273ms. Up an octave to 880Hz, and the period is 1.136ms. Up another octave to 1760Hz and we have to move to microseconds for expressing the period: 568.2µs or 0.5682ms. This is quite a wobble, if you think about it - the waveform is going from positive to negative in just over half a thousandth of a second.

'Wobbles' is actually a very useful word for describing sine waves. That smooth shape is not an accident - it turns out that if you make a ruler twang, or watch a pendulum swing, or pluck a string, or turn an amp up so that you get feedback from a microphone, then the basic shape of the time wavform that you get is probably a sine wave (or similar). This is because objects in the real world are lazy - they expend as little effort (energy) moving as possible, and the way of something moving back and forth (or up and down, or side-to-side) using the least energy is a sine wave. Look up 'Simple Harmonic Motion' if you want to read about maths and physics... It a bit like: 'the shortest distance between two points is a straight line' - it's one of those fundamental things about how the universe works.

If you want, you can do a totally non-scientific experiment that kind of illustrates this 'least energy' thing. Hold out your arm, with your hand vertical. Now wave it from side to side smoothly counting 'one thousand, two thousand, three thousand...' so that you are doing one cycle every second (a frequency of one cycle per second is 1 Hertz (Hz), and has a period of 1 second!). Then try jerking your hand as quickly as you can between two stationary positions about 100mm apart at the same rate. Instead of a smooth, continuous waving movement, it should be just two brief movements interspersed with waiting. You should find that it feels like you are using much more energy to do the 'Square-shaped' wave than the smooth 'Sine' wave.

So the sine wave is interesting and important because it is least energy and a very smooth shape, and it turns out that it is pretty fundamental in other ways too - you can make any waveshape by adding together sine waves of different frequencies, amplitudes and phases. Phase is just the relationship between two waveforms. If they are 'in phase' (no phase difference) then they go up and down at the same time... Let's look at some diagrams:

Combining and extracting multiple sine waves will be examined in more detail in a future part of this series.

### The Waveform - Deeper

Wrapping the time axis around so that it forms a circle is actually a clue to what the 'single cycle' diagram really is - a convenient abstraction that turns reality into something easy to visualise. Actually, a waveform is always moving up and down in time, and the waveform view just captures that up and down movement and makes it visible. If the sine wave is a sound, then the waveform shows how the air is compressed and rarified (not a word we use very much!). If the sine wave is a voltage, then it shows the change of voltage as the sine wave moves up and down. So a waveform is like a long exposure photograph that freezes movement. (or a stroboscope that uses a flashing light to 'freeze' movement...)

Let's dig deeper into a waveform:

### Single Cycles

You should now know more about single cycle waveforms, what they are, how they work, and some of the terminology around them. You also now know that the shape of the waveform is related to the timbre (or sound), and that the shape can be produced by adding together different frequency sine waves - although it seems that phase complicates this. But essentially, a single cycle waveform is a little fragment of timbre - actually, it is the smallest fragment you can have that gives a specific sound.

Single cycle waveforms were used in early analogue oscillators, and were chosen to provide a diverse set of timbres. Sine waves for simplicity and 'purity' of tone. Square waves because they sound hollow. Sawtooth waves because they sound sharp and bright. And Pulse waves because they sound thin and buzzy. All of these are fixed 'snapshots' of timbre - they don't change over time.

Over time, oscillators were extended to provide additional waveforms - and significantly, these can change over time: Pulse Width Modulation changes the shape of a pulse wave so that it sounds 'animated' or 'chorussed'. Oscillator sync resets one oscillator waveform using another, and so generates a distinctive, glitchy sound.

Using wavetables instead of fixed singe cycle waveforms allows the timbre to be changed over time: either smoothly by interpolating from one waveform to the next, or simply jumping abruptly from one to the next, which can give a fascinating 'glassy' texture. The ultimate smooth and long wavetable is a sample, of course, with a long looped sustain and a long looped release.

So there's a basic split between the single cycle, 'fixed' waveforms, and the multi-cycle, 'timbre changes with time' waveshapes (made from wavetables or samples). Of course, the ultimate 'timbre changes over time' is noise, where it is randomly different every time.

There's a simple model for sound synthesis that has Controllers controlling sound Sources like oscillators whose outputs are then altered in timbre and volume by Modifiers to produce the final sound output. When the output of an oscillator can change timbre over time then it stops being a pure 'Source' of sound of acquires some of the functionality of a Modifier, but then models are only supposed to be approximations of reality.

### Analogue and Digital

### Links

Pianobook videos (This one describes an ADSR envelope...)

Pianobook.co.uk (Free user-created samples (crowd-sourced samples?))

Schrodinger's Cat (A sideways route into quantum physics...)

If you find my writing helpful, informative or entertaining, then please consider visiting this link:

Synthesizerwriter's Store (New 'Modular thinking' designs now available!)

## No comments:

## Post a comment