As an electronic musician I've always been fascinated by sine waves. They were present on my first Moog synthesiser as a sound generator option, and when sampling became available in the late 80s I learnt that any sound can be broken down into its constituent sine waves using Fourier analysis, and then reconstructed again. (Find out more about Fourier analysis in the Plus podcast.) Virtually every sound heard today from any digital device — from HDTV to the iPod — is described as a sum of its sine wave parts in the digital realm.

Sine waves are unique in that they are the only sound in nature not to contain any harmonics beyond their fundamental frequency — they are the vampires of the sound world casting no harmonic shadow or reflections.

The piece of music I wrote for the Geekpop Festival, Sine Language, explores the idea of sine waves, and how they relate to other concepts such as the Western tuning system known as equal temperament, and even to ancient Greek cosmological ideas (listen to Sine Language).

Making music

Sine waves are fascinating because they are theoretically perfect — they contain no harmonics above their fundamental frequency (or in musical terms, their pitch). Because of this, several overlaid sine waves of particular pitches aren't always interpreted as discrete tones by the ear, but as just one sound whose timbre is modulating. The first minute or so of Sine Language introduces 7 differently pitched sine waves one by one, starting low and ending high. These 7 tones — which comprise the first half of the piece — are tuned to perfect fifths. This is unusual because fifths on a piano keyboard are actually not perfect. To understand why this is, a brief diversion on the history of Western tuning is required — starting with the ancient Greeks.

Apocryphally it was Pythagoras who noticed that harmonious notes were created by a blacksmith striking particular sized anvils, and this got him thinking about the mathematical principles of harmony. He went on to discover that dividing a string in two and plucking it produces a note that is double the original pitch of the string. So if the original string vibrates 500 times a second (i.e. a frequency of 500Hz), and the length of the string is halved it will vibrate at double the frequency — that is 1000 times a second (1000Hz)

Two sine waves of the same amplitude, one

half the frequency of the other

Musically, this means that we hear the 1000Hz tone as double the pitch of the 500Hz tone — this is called an octave. If you were to play both tones together, they would sound harmonious because for every one vibration of the 500Hz tone, you can fit the 1000Hz tone in twice. Our ears and brain interpret this as pleasant sounding — perhaps because it takes fewer receptors in our ears to interpret and pass the information to the auditory part of the brain.

But a ratio of one to two is not the only ratio our ears interpret as harmonious. In one of those elegant surprises of nature, many other whole number ratios also sound pleasant to us, and by including other ratios you can construct a scale known as just intonation:

Musical interval Ratio of frequencies C-D 9:8 C-E 5:4 C-F 4:3 C-G 3:2 C-A 5:3 C-B 15:8 C-C 2:1

The ancient Greeks were so impressed with the neatness of this discovery, that they based a whole philosophy on it, which became known as the music of the spheres. At the time it was believed the orbits of the planets and the Sun were perfect circles centred on the Earth, and that these celestial objects moved in their orbits on crystal spheres. The spacing of these spheres were the perfect mathematical ratios arising from musical intervals, and their movement against each other produced the music of the spheres. Though it was inaudible to human beings, it represented the perfection of the universe.

The ancient Greek concept of celestial spheres

However, beautiful as this idea is, there are several problems with dividing a scale up using just intonation and there have been many different attempts to solve it — but a permanent solution wasn't found in the West until the 17th century.

Musically, the system of perfect ratios only works if you wish to remain in one key. As can be seen in the table of C major (above), all the notes are tuned perfectly for the key of C. So any piece of music you wish to write will have to start on C, end on C, and only use the white notes of the keyboard if it is going to sound "right". This is because if you were to start on D, all the equivalent ratios for the notes on the scale would be completely different, or in musical terminology, horrible sounding! On our keyboard tuned (using just intonation) to the key of C, the notes D and A have frequencies of 9/8 and 5/3 times the frequency of C. But according to just intonation, a perfect fifth above D is 3/2 times its frequency, which is 27/16 times the frequency of C (3/2 times 9/8); this is close to, but not exactly the frequency of A (5/3 times the frequency of C) on our keyboard. And this is before we even consider the black keys and how they should fit into the scheme. (For more discussion on mathematical ratios of musical notes read Music and Euclid's Algorithm.)

One can imagine that staying in the key of C and using only the white notes is somewhat boring and can produce only a limited range of tonal variation. Musicians are generally adventurous types, not content with simply replicating what went before, and by the 1600s various systems had been developed in the West to allow for more movement among the keys. Such movement is called modulation, and to find a system that allowed modulation between all the keys, say from C to D, without the key of D sounding completely awful was very difficult. Technically these out of tune notes were called wolf notes and were the bane of baroque and earlier composers.

A harpsichord (circa 1620) with split black notes tuned to sound good in different keys (Image courtesy Edinburgh University Collection of Historic Musical Instruments)

After the various attempts to solve this problem (including building piano keyboards with split black notes so the correctly tuned one could be picked for the key you were in, see picture above) the solution used today, called equal temperament, is the perfect compromise: keep all the octave ratios of 2:1 perfect, but average out all of the other notes of the scale. This means that instead of one key being perfect and the others being wrong in their own unique and horrible way, all the keys are equally slightly wrong, but in such a way that is acceptable for all possible keys.

In mathematical terms this simply means that each of the 12 semitones in an octave are 1/12th of an octave higher or lower than their neighbours. The amount of detuning away from the "perfect" is sometimes referred to as the Pythagorean gap in deference to the original Greek idea of harmonic perfection.

Before equal temperament came what were known as well temperament systems. These were similar in that they allowed free modulation across keys, but weren't quite so mathematically precise. For example, Werckmeister's systems of the late 17th century involved specifying various flattenings and sharpenings of fifths and thirds. However, despite these not being the best mathematical solution, they were sufficient for JS Bach to write the 48 Preludes and Fugues, in which there is one piece for each and every possible scale, major and minor, on the keyboard. This ability to write in different keys — and to modulate between them in the same piece — was simply not possible before well temperament was invented.

What all of the above means is that we are very used to hearing music in equal temperament and the sound of a perfectly tuned scale is quite unfamiliar and can even sound wrong to our ears. All this connects back to my piece as I've used a whole number ratio to generate the fifth note of the scale which produces a harmony more closely related to the Greek perfect harmony than the more recent equal temperament.

Writing Sine Language

The first half of Sine Language is constructed from just seven notes that are differently tuned sine waves:

The fundamental — a B♭ with a frequency of 116.541hz The fundamental frequency times 2 (an octave higher) The fundamental frequency times 3 (a fifth above note 2) The fundamental frequency times 4 (two octaves above the fundamental) The fundamental frequency times 6 (a fifth above note 4) The fundamental frequency times 8 (three octaves above the fundamental) The fundamental frequency times 12 (a fifth above note 6)

A close up of the score of Sine Language

showing the wave forms of each note.

The ratios of the perfect fifths (3:2) and

octaves (2:1) can be easily seen — the top

wave, note 7, completes 3 cycles in the time

note 6 complete 2 cycles, and note 6 completes

2 cycles in the time note 4 completes 1.

So the fundamental has been multiplied by a sequence of whole numbers: the frequency of every second note is multiplied by two (to go up an octave), and the notes in between have frequencies 3/2 times higher (perfect fifths). This is an arbitrary decision based on the fact that most music uses these numbers — 2, 3 and 4 — a great deal: time signatures usually have either 3 or 4 beats per bar length, and often musical phrases are built up in multiples of 4 or 8 bar chunks (and sections, especially in classical music, tend to be 16, 32 or 64 bars long). It would require another essay to investigate the reason for powers of 2 to be so "natural sounding" in music, or whether it's simply convention (other world cultures do use other systems).

The other simple mathematical idea of the first half is to use the same mathematical sequence to define the rhythm. I've simply decided that there should be one "perfect" bar in the piece of music towards which the first half builds and that the second half of the piece then uses this perfect bar as a launchpad for more freeform composition. This bar can be defined as the follows:

The 'perfect' bar: showing the rhythmic patterns

of each note Note 1 sounds once a bar

Note 2 sounds twice a bar

Note 3 sounds three times a bar

Note 4 sounds four times a bar

Note 5 sounds six times a bar

Note 6 sounds eight times bar

Note 7 sounds twelve times a bar

Musically this has the effect of layering triplets over duplets, a not-uncommon technique used in much music. Romantic music of the late 19th century does this all the time as the effect is to speed up or slow notes down against the pulse, but in such a way to be musically pleasing. For example you can play three notes in the time it would normally take to play two (known as a triplet) and still end up in the right place in the bar for the next note. As doing this goes against the predominant pulse it is pleasantly surprising without totally disrupting the flow of the music.

In the case of the "perfect" bar I have described above, it sets up a pleasing pulsating sound which sounds cohesive yet clearly made up of discrete elements: you can listen to the bar (repeated several times) here.

The added twist is that the individual notes comprising this cascade of sound are tuned in a non-standard way, but because they are whole tone and whole number ratios, they still sound harmonious — if slightly unusual to the trained ear.

The first half of the piece, then, builds up to this defining bar by gradually introducing the pattern into the music. One by one the sine waves are introduced and gradually shift from a gentle volume wax and wane to a discrete jump in volume from zero to maximum. A shift from fuzzy analogue "in-between" volumes to binary states of off and on.

The diagram below is in fact the score of the first half of the piece and shows how these shifts take place. However, they are quite hard to hear as the ear tends to merge sine waves into a composite sound so that what you experience is subtly shifting harmonic content — at least up until the point where all the sine waves have reached the perfect bar and the distinct pitches are audible.

The score of Sine Language: you can see the gradually introduction of the 7 notes, and the introduction of the rhythm note by note, starting from the fundamental at the bottom of the score. (Click on image for larger version)

The second half of the piece is where the perfect bar is placed in a sampler — a musical device that can replay any sound at any pitch by slowing it down or speeding it up to the correct frequency. This technique has become so ubiquitous over the last 20 years that I hardly need to provide an example of how it works, but here is the perfect bar played back by a sampler, first at its orginal pitch, and then at different pitches, descending by an octave each time.

The second half of the piece is more arbitrarily musical than mathematical — once in the sampler, it can be 'played' as if it were a normal sound, such as the piano. Because of the nature of the sound though, the effect of playing chords with it is to create an interweaving, interlocking web of pulsating sine waves at mathematically interesting pitches, and certainly not those of equal temperament. You can listen to the whole piece here.

Sine Language from flippers on Vimeo.

One catch, however, is that the sampler does play back the pitches at equal temperament (as this is the tuning system that the sampler uses), so the resultant music in this section is a perfectly tuned bar played back at equally tempered pitch intervals. The resulting tuning is therefore impossibly complicated, and I think should be simply described as the Pythagorean gap squared!

What completes the circle for me is that the culminated effect of the overlayed sine waves and tunings remind me of a JS Bach organ work, possibly even one of the fugues from the 48, and it pleases me that although this has been arrived at by a mathematical process, it has tended towards a similar output. Though I should hastily point out that I'm in no way claiming any of Bach's genius and understanding of harmony and melody — this is a passing (if happy) musical similarity!

About the author

Oli Freke is a member of the electropop group Cassette Electrik, who supported The Human Leauge on their Dare 2007 tour. His new side project On Rails is for more experimental work, of which Sine Language is the first piece, composed for GeekPop 2009.