But now the sine wave is unavoidable - according to my textbook the sine wave is "everything" in music programming. From physics I knew sound is constructed of waves, and I'd seen the sine wave on synths, but I was still sure there were other waves too - square looking waves and triangle looking waves. Instruments on an oscilloscope showed some kind of repeating wave, but it was nothing like a sine wave.

Here's a sine wave for the mathematically deprived |

Here's where Fourier series come in. Thanks to the works of a clever frenchman, Joseph Fourier, we now know that every periodic (repeating) wave can be made just out of sine waves in different ratios of frequency and amplitude. By this we might mean we choose certain frequencies, and then for the higher frequencies, we'll make them quieter and quieter. By carefully choosing the frequencies and amplitudes we can make the important square, saw-tooth and triangle waves. Here's one I made earlier.

A sawtooth wave with 3 harmonics |

Sawtooth Wave Harmonics by Boyley

For reference, without any harmonics you're going to just have a plain old sine wave, and as the sound clip progresses, one at a time (about every 1-2 seconds), I've added more and more harmonics. The little pause is followed by a richer wave with 20 harmonics.

The different waves all have their own rules. The square wave has only odd harmonics, and the amplitude of each harmonic is 1/the harmonic number. In English: the 1st harmonic will have an amplitude of 1 (no change), the 3rd harmonic has an amplitude of 1/3 (the sine wave is 1/3 as tall), the 5th harmonic has an amplitude of 1/5, and so on, to infinite and beyond. Although, with a synth, we might say, do the first 20 harmonics, because I want my sound generated in finite time. When we add sine waves we'll get bits that add to each other (constructive) and bits that cancel out (destructive), and with this ratio, our wave becomes squarer and squarer. I'm not sure that's a word...

For the triangle wave we take odd harmonics again, but the amplitude for each harmonic is 1/(harmonic number)^2 (squared). The saw-tooth wave is a bit special because every harmonic is used, with amplitudes of 1/harmonic number. A little protip I found was if the wave is symmetrical when reflected across the x axis e.g. the triangle wave, it must only have odd harmonics. Otherwise, it must include some even harmonics (it might still have odd harmonics).

Hopefully this wave is self explanatory |

Take a guess... |

So there it is. Pretty much the mathsy fundamentals behind the synth stuff that I'm currently doing. I can't currently write any more on Fourier series or analysis, but scanning through my textbook there's definitely more to come. Next time I'll try not to write so much about maths.

## No comments:

## Post a Comment