Saturday, September 7, 2013

A-Flat Minor part I - Harmonics

A-flat Minor I—Visualizing harmonics

What is a major chord? It sounds like a simple question, and if you ask a musician, they might say something like a root, a major-third and a prefect fifth. When I started looking into chords and how they're created this seemed like a great answer. Surely these fractions correspond to some perfect ratios, where a third indicates maybe a third of the main frequency and a fifth is a fifth Or at least something to do with 3 and 5. Erm, no. It turns out you simply count, starting at 1: a 'third' is simply the third note you reach and the fifth the fifth (eg for the scale of C, a 'third' is E and a fifth is G, you just count up from C, with C=1).

So in that case, what is a major chord? Wikipedia comes to the rescue, telling you it's notes in the ratio 4:5:6. This is at least meaningful, but seems a little arbitrary - how are these ratios chosen and why do they sound so good together? Luckily, there's a link from there to a very interesting page about Otonality and Utonality. Here, it describes how the major chord can be made up of the first three unique notes from the integer harmonics of a note (ie for a note with frequency f, we take 2f, 3f, 4f... etc., these tend to happen to some extent in real instruments naturally). Let's take C4 (middle C, 262.626Hz) as an example, and look at the notes we get for the first few harmonics:

A#6 (ish)7

Here we can see the first 3 unique notes (C4, G5, E6) have ratios of 1:3:5. However, because doubling (or halving) the frequency gives us the same note, we can move the notes to the same octave by multiplying by 4, 2,1 to  give us the 4:6:5 ratio we expect. (It might seem odd that a major chord has no notes above 6/4 times the root note. What happens to the next obvious choice: 7/4? I think this note gets too 'close' to the root note (in linear scale, both 5/4 and 7/4 are 1/4 away from the root, but acoustically I think the 7/4 (or 7/8 if we move it to just below the root) starts to sound very close to it and a little discordant. Maybe.)

Visualizing Harmonics

Is there a simple way to visualize these harmonics? What would be nice is a way to see harmonics and get some idea of the note and octave. A common way of visualizing this is using a music helix where the note becomes an angle and the octave a height. This can then be flattened to form a spiral (and there's a fascinating website about that here, with a lot of videos of music and the corresponding spectrogram).

I used Python to write a program that would allow me to visualize harmonics and chords in a similar fashion. Here's what a single root note, with no harmonics looks like:

The small red bar near the center represents the root note. As more notes get added, they'll appear on the spiral, further out at higher frequencies and at an angle corresponding to the note.

Now lets look at the first 3 harmonics:

We again see the root, red, and right above it the second harmonic in green. The third harmonic appears further along on the spiral in the fifth (V) location in blue. The third harmonic is the 'fifth' mentioned earlier (ie G if the root is C).

Now let's look at the first 5 harmonics, and see the notes of our major chord:

This time the first, second and 4th harmonics are in red (they're all the root note, say C), the 3rd in green (this is the V, G) and the 5th in blue (the 'major third', III, E). These are the three notes of the major chord, represented here with the root at 12 o'clock, the 'fifth' at 6 o'clock and the major third at 3 o'clock.

It's interesting to see what notes we hit if we just keep adding harmonics. What happens if we just add harmonics up to an arbitrary limit? Below I start at 440Hz and add all harmonics til we reach past the limit of most people's hearing, 22.1kHz:

Here we can see that once a note has been hit, it will get hit again the next go round (not surprisingly, as if h is a harmonic, so will 2h). It's also interesting to see which notes in the scale we hit - after the III and V notes, we hit the II and VII notes pretty early on, and then some odd incidentals (IIb and IV#). Oddly, the 7th harmonic (9 o'clock in the diagram above) isn't close to any of the natural notes, even though it's the next unique note after the major chord notes. (This is arguably a case for dismissing harmonics much higher than the 7th - after all, if the 7th harmonic is the next one and we haven't even bothered naming a note for it, can harmonics any higher than this really be that important? I'm going to ignore that question and carry on ignorantly).

I'm going to stop there and next time look at what happens when you combine the harmonics of the chords together, and also take a look at minor chords. You can find part II here.

Technical details about the charts above

In the charts above, I've decided to make the angle linear with frequency so that the fifth, which is 3/2 the root, occurs at 180 degrees. This means that doubling the frequency of a note will some of the time put the note 180 degrees opposite, and sometimes not. If I had used a log scale for the notes, a doubling would be the same for all the notes, but at a rather less convenient 210 degrees. The software below allows you to choose either method. The lines for the notes are for the just intonation tones.


The software used to create the diagrams above is available from my github account. The UI requires the ui_decorators module, talked about here.

No comments:

Post a Comment