Overtones and Barbershop Quartets

I’ve heard that barbershop quartets often sign the 7th in a dominant 7th a little flat in order to bring the note closer in tune with the overtone series. This post will quantify that assertion.

The overtones of a frequency f are 2f, 3f, 4f, 5f, etc. The overtone series is a Fourier series.

Here’s a rendering of the C below middle C and its overtones.

\score { \new Staff { \clef treble <c c' g' c'' e'' bes''>1 } \layout {} \midi {} }

We perceive sound on a logarithmic scale. So although the overtone frequencies are evenly spaced, they sound like they’re getting closer together.

Overtones and equal temperament

Let’s look at the notes in the chord above and compare the frequencies between the overtone series and equal temperament tuning.

Let f be the frequency of the lowest note. The top four notes in this overtone series have frequencies 4f, 5f, 6f, and 7f. They form a C7 chord [1].

In equal temperament, these four notes have frequencies 224/12 f, 228/12 f, 231/12 f, and 234/12 f. This works out to 4, 5.0397, 5.9932, and 7.1272 times the fundamental frequency f

The the highest note, the B♭, is the furthest from its overtone counterpart. The frequency is higher than that of the corresponding overtone, so you’d need to perform it a little flatter to bring it in line with the overtone series. This is consistent with the claim at the top of the post.

Differences in cents

How far apart are 7f and 7.1272f in terms of cents, 100ths of a semitone?

The difference between two frequencies, f1 and f2, measured in cents is

1200 log2(f1 / f2).

To verify this, note that this says an octave equals 1200 cents, because log2 2 = 1.

So the difference between the B♭ in equal temperament and in the 7th note of the overtone series is 31 cents.

The difference between the E and the 5th overtone is 14 cents, and the difference between the G and the 6th overtone is only 2 cents.

More music posts

[1] The dominant 7th chord gets its name from two thing. First, it’s called “dominant” because it’s often found on the dominant (i.e. V) chord of a scale, and it’s made from the 1st, 3rd, 5th, and 7th notes of the scale. It’s a coincidence in the example above that the 7th of the chord is also the 7th overtone. These are two different uses of the number 7 that happen to coincide.

Equipentatonic scale

I ran across a video that played around with the equipentatonic scale [1]. Instead of dividing the octave into 12 equal parts, as is most common in Western music, you divide the octave into 5 equal parts. Each note in the equipentatonic scale has a frequency 21/5 times its predecessor.

The equipentatonic scale is used in several non-Western music systems. For example, the Javanese slendro tuning system is equipentatonic, as is Babanda music from Uganda.

In the key of C, the nearest approximants of the notes in the equipentatonic scale are C, D, F, G, A#. Approximate equipentatonic scale

In the image above [2], the D is denoted as half sharp, 50 cents higher than D. (A cent is 1/100 of a half step.) The actual pitch is a D plus 40 cents, so the half sharp is closer, but still not exactly right.

The F should be 20 cents lower, the G should be 20 cents higher, and the A# should be 10 cents higher.

Notation

The conventional chromatic scale is denoted 12-TET, an abbreviation for 12 tone equal temperament. In general n-TET denotes the scale that results from dividing the octave into n parts. The previous discussion was looking at how 5-TET aligns with 12-TET.

A step in 5-TET corresponds to 2.4 steps in 12-TET. This is approximately 5 steps in 24-TET, the scale we’d get by adding quarter tones between all the notes in the chromatic scale.

Math

When we talk of dividing the octave evenly into n parts, we mean evenly on a logarithmic scale because we perceive music on a log scale.

The notation will be a little cleaner if we start counting from 0. Then the kth note the n-TET scale is proportional to 2k/n.

The proportionality constant is the starting pitch. So if we start on middle C, the frequencies are 262 × 2k/n Hz. The nth frequency is twice the starting frequency, i.e. an octave higher.

We can measure how well an m-TET scale can be approximated by notes from an n-TET scale with the following function:

d(m, n) = \max_j \min_k \left|\frac{j}{m} - \frac{k}{n} \right|

Note that this function is asymmetric: d(mn) does not necessarily equal d(nm). For example, d(12, 24) = 0 because a quarter tone scale contains exact matches for every note in a semitone scale. But d(24, 12) = 1/24 because the quarter tone scale contains notes in between the notes of the semitone scale.

The equipentatonic scale lines up better with the standard chromatic scale than would a 7-note scale or an 11-note scale. That is, d(5, 12) is smaller than d(7, 12) or d(11, 12). Something similar holds if we replace 12 with 24: d(5, 24) is smaller than d(m, 24) for any m > 1 that is relatively prime to 24.

Related posts

[1] The video first presents 10-TET and then defines 5-TET as taking every other note from this scale.

[2] The image was created with the following Lilypond code.

\score {
  \new Staff {
    \relative c' {
      c1 dih f g aih c \bar "|."
    }
  }
  \layout {
    \context {
      \Staff
      \remove "Bar_engraver"
      \remove "Time_signature_engraver"
    }
  }
}

Grokking the James Bond chord

The last chord of the James Bond theme is known as the James Bond chord. If you’ve ever seen a Bond movie, you’ll recognize it. Here’s a quick video showing how to play it on guitar.

I tried asking Grok 3 to generate some LilyPond code for sheet music a few days ago. LilyPond is pretty obscure as programming languages go—it’s not like asking for Python code—so I was skeptical, but Grok did well.

This afternoon I asked Grok to create sheet music for the James Bond chord. Specifically, I asked

  1. What is the “James Bond chord”?
  2. Create sheet music for the James Bond chord using Lilypond.
  3. Move the chord up an octave.

Here’s the output of each step.

What is the chord?

According to Grok,

The “James Bond chord” is a distinctive musical chord famously associated with the James Bond film franchise. It’s not just a single chord but rather a specific voicing and progression that evokes a sense of mystery, danger, and sophistication—perfectly matching the suave spy’s persona. Officially, it’s often identified as an E minor major 9 chord (EmMaj9), though its exact interpretation can vary slightly depending on the context.

The chord was first introduced by composer Monty Norman in the “James Bond Theme” for Dr. No (1962), arranged by John Barry, whose orchestration gave it its iconic swagger. …

First output

Grok produced the following LilyPond code

\version "2.22.0"

\score {
  \new Staff {
    \clef treble
    \key c \major % Default key, no sharps/flats; we'll specify accidentals manually
    \time 4/4
     <e g b dis' fis'>1 % EmMaj9 chord: E G B D# F#
  }
  \layout {}
  \midi {}
}

When compiled this gave the following music.

Grok also produce a MIDI file.

Second output

I wanted to move the chord up an octave for aesthetic reasons, putting the notes inside the staff. Grok complied, changing one line in the code, essentially adding an extra prime mark after each note.

<e' g' b' dis'' fis''>1 % EmMaj9 chord moved up an octave: E' G' B' D#'' F#''

This compiled to the following music.

Problems and prospects

Grok’s not perfect. In another experiment it produced code that wouldn’t compile. But when I told Grok that the code didn’t compile and asked it to try again, it worked.

I tried to remove the time signature, the C symbol. I asked Grok to remove it, and it did not. I asked Grok “How do you get LilyPond to produce music without a time signature?” and it told me two ways, neither of which worked.

I’ve used LilyPond occasionally for years, not to produce full sheets of music but to produce little fragments for blog posts. I’ve always found it a bit mysterious, in part because I jumped in and used it as needed without studying it systematically. There have been times when I thought about including some music notation in a blog post and didn’t want to go to the effort of using LilyPond (or rather the effort of debugging LilyPond if what I tried didn’t work). I may go to the effort more often now that I have a fairly reliable code generator.

Posts using LilyPond

The Clausen function

I ran across the Clausen function the other day, and when I saw a plot of the function my first thought was that it looks sorta like a sawtooth wave.

Plot of Clausen function Cl_2

I wondered whether it also sounds like a sawtooth wave. More on that shortly.

The Clausen function can be defined in terms of its Fourier series:

\text{Cl}_2(x) = \sum_{k=1}^\infty \frac{\sin(kx)}{k^2}

The function commonly known as the Clausen function is one of a family of functions, hence the subscript 2. The Clausen functions for all non-negative integers n are defined by replacing 2 with n on both sides of the defining equation.

The Fourier coefficients decay quadratically, as do those of a triangle wave or sawtooth wave, as discussed here. This implies the function Cl2(x) cannot have a continuous derivative. In fact, the derivative of Cl2(x) is infinite at 0. This follows quickly from the integral representation of the function.

\text{Cl}_2(x)=-\int_0^x\log \left|2\sin\frac{t}{2} \right|\, dt

The fundamental theorem of calculus shows that the derivative

\text{Cl}'_2(x)=-\log \left|2\sin\frac{x}{2} \right|

blows up at 0.

How does it sound?

What does it sound like if we create music with Clausen waves rather than sine waves? I initially thought it sounded harsh, but that turned out to be an artifact of how I’d make the audio file. A reader emailed me a better recording using the first few notes of a famous hymn. It’s a much more pleasant sound than I had expected.

ein_feste_burg.wav

 

Related posts

The Real Book

I listened to the 99% Invisible podcast about The Real Book this morning and thought back to my first copy.

My first year in college I had a jazz class, and I needed to get a copy of The Real Book, a book of sheet music for jazz standards. The book that was illegal at the time, but there was no legal alternative, and I had no scruples about copyright back then.

When a legal version came out later I replaced my original book with the one in the photo below.

The New Real Book Legal

The podcast refers to “When Hal Leonard finally published the legal version of the Real Book in 2004 …” but my book says “Copyright 1988 Sher Music Co.” Maybe Hal Leonard published a version in 2004, but there was a version that came out years earlier.

The podcast also says “Hal Leonard actually hired a copyist to mimic the old Real Book’s iconic script and turn it into a digital font.” But my 1988 version looks not unlike the original. Maybe my version used a kind of typesetting common in jazz, but the Hal Leonard version looks even more like the original handwritten sheet music.

More ways of splitting the octave

in an earlier post I said that the arithmetic mean of two frequencies an octave apart is an interval of a perfect fifth, and the geometric mean gives a tritone. This post will look at a few other means.

Intervals

The harmonic mean (HM) gives a perfect fourth.

The arithmetic-geometric mean (AGM) gives a pitch about midway between a tritone and a fifth, a tritone plus 50 cents.

The arithmetic mean gives a perfect fifth.

The contraharmonic mean gives an interval of a major sixth.

The intervals for HM, AM, and CHM are exact, using just tuning. The intervals for GM is exact using equal temperament. The AGM is not close to a chromatic tone in any system.

If we take the means of A 440 and A 880, the AGM is an E half-flat (hence the backward flat sign above).

Equations

Here are the equations for the various means:

\begin{align*} HM(a, b) &= \frac{2ab}{a + b} \\ GM(a, b) &= \sqrt{ab} \\ AM(a, b) &= (a + b)/2 \\ CHM(a, b) &= \frac{a^2 + b^2}{a + b} \end{align*}

The AGM is defined iteratively: Take the GM and AM of the pair of numbers, then take the GM and AM of the result, and so on, taking the limit. More detail here.

Frequencies

Here are the frequencies of the means.

    |------+-----|
    | Mean |  Hz |
    |------+-----| 
    | HM   | 586 |
    | GM   | 622 |
    | AGM  | 641 |
    | AM   | 660 |
    | CHM  | 733 |
    |------+-----|

Lilypond

Here’s the Lilypond code that was used to create the music notaton above.

\begin{lilypond}

\new Staff \with { \omit TimeSignature} {
  \relative c''{
     <a d>1 <a ees'>1 <a eeh'>1 <a e'>1 <a fis'>1 |
  }
  \addlyrics{"HM" "GM" "AGM" "AM" "CHM" }
}

\end{lilypond}

Update: Two octaves

What if we look at frequencies two octaves apart, 220 Hz and 880 Hz? You might expect the size of the intervals to double. That intuition is exactly correct for the geometric mean: a tritone is half an octave (on a log scale) and so two tritones is an octave.

This intuition is also approximately correct for the arithmetic-geometric mean. But it over-estimates the harmonic mean and under-estimates the arithmetic and contraharmonic means.

Tritone

A few weeks ago I wrote about how the dissonance of a musical interval is related to the complexity of the frequency ratio as a fraction, where complexity is measured by the sum of the numerator and denominator. Consonant intervals have simple frequency ratios and dissonant intervals have complex frequency ratios.

By this measure, the most consonant interval, other than an octave, is a perfect fifth. And the most dissonant interval is a tritone, otherwise known as the diminished fifth or augmented fourth. So in some sense perfect fifths and tritones are opposites, but they are both ways of splitting an octave in half, just on different scales.

Linear scale versus log scale

When we say simple frequency ratios are consonant and complex frequency ratios are dissonant, we are speaking about ratios on a linear scale. But we often think of musical notes on a logarithmic scale. For example, we think of the notes in a chromatic scale as being evenly spaced, and they are evenly spaced, but on a log scale.

If we divide an octave in half on a linear scale, we get a perfect fifth. For example, if we take an A 440 and an A 880 an octave higher, the arithmetic mean, the midpoint on a linear scale, we get E 660.

But if we divide an octave in half on a log scale, we get a tritone, three whole steps or six half steps out of 12 half steps in a chromatic scale. The midpoint on a log scale is the geometric mean. The geometric mean of 440 and 880 is 440 √2 = 622, which is D#.

So we take the midpoint of an octave on a linear scale we get the most consonant interval, a perfect fifth, but if we take the midpoint of an octave on a log scale we get the most dissonant interval, a tritone.

Tritone substitution

Intervals of a fifth are so consonant that they don’t contribute much to the character of a chord. It is common to leave out the fifth.

Tritones, however, are essential to the sound of a chord. In fact, it is common to replace a chord with a different chord that maintains the same tritone. For example, in the key of C, the G7 chord contains B and F, a tritone. The chord C#7 contains the same two notes (though the F would be written as E#), and you’ll often see a C#7 chord substituted for a G7 chord. So a song that had a Dm–G7–C progression might be rewritten as Dm–C#7–C, creating a downward chromatic motion in the base line.

This is called a tritone substitution. You could think of the name two ways. In the discussion above we talked about preserving the tritone in a chord. But notice we also changed the root of the chord by a tritone, replacing G with C#. More generally, replacing any chord with a chord whose root is a tritone away is called a tritone substitution or simply tritone sub. For example, a D minor chord does not contain a tritone, but we could still do a tritone sub, replacing Dm with G#m because D and G# are a tritone apart.

Related posts

The Very Model of a Professor Statistical

The last chapter of George Box’s book Improving Almost Anything contains the lyrics to “I Am the Very Model of a Professor Statistical,” to be sung to the tune of “I Am the Very Model of a Modern Major General” by Gilbert & Sullivan.

Here’s the original:

The original song has a few funny math-related lines.

I’m very well acquainted, too, with matters mathematical,
I understand equations, both the simple and quadratical,
About binomial theorem I’m teeming with a lot o’ news,
With many cheerful facts about the square of the hypotenuse.

I’m very good at integral and differential calculus;
I know the scientific names of beings animalculous:
In short, in matters vegetable, animal, and mineral,
I am the very model of a modern Major-General.

Here are a few lines from George Box’s version.

I relentlessly uncover any aberrant contingency
I strangle it with rigor and stifle it with stringency
I understand the different symbols be they Roman, Greek, or cuneiform
And every distribution from the Cauchy to the uniform.

With derivation rigorous each lemma I can justify
My every estimator I am careful to robustify
In short in matters logical, mathematical, idealistical
I am the very model of a professor statistical.

Gilbert & Sullivan have come up on this blog a couple other times:

George Box has come up too, but only once. (I’m surprised he hasn’t come up more; I should rectify that.) This post has a great quote from Box: “To find out what happens to a system when you interfere with it, you have to interfere with it (and not just passively observe it).”

YYZ and Morse code

The song YYZ by Rush opens with a theme based on the rhythm of “YYZ” in Morse code:

    -.--  -.--  --..

YYZ is the designation for the Toronto Pearson International Airport, the main airport serving Toronto. The idea for the song came from hearing the airport identifier in Morse code.

However, the song puts no spaces between rhythm corresponding to each letter. Here’s what the opening riff would look like in sheet music:

Each dash is a middle C and each dot is an F# a tritone below middle C.

When I listen to the song, I don’t hear YYZ. My mind splits up the rhythm with each sequence of long notes starting a group:

    -.  ---.  ----..

So I hear the 20/8 time signature as (3 + 7 + 10)/8.

In terms of Morse code, -. is N. Interpreting the other groupings depends on what you mean by Morse code. The American amateur radio community defines Morse code as 40 characters: the 26 letters of the Latin alphabet, 10 digits, and 4 more symbols: / = , . Using that definition of Morse code, there are no symbols corresponding to ---. or ----... There is no symbol corresponding to ---- either. More on unused sequences here.

However, sometimes ---. is used for Ö and ---- for Š. So the way I hear “YYX” would be more like “NÖŠI”.

There are many other ways to parse -.---.----.. into Morse code symbols. For example, NO1I

    -.  ---  .----  ..

Enumeration

How many ways could you split -.---.----.. into valid Morse code?

Here’s an outline of a recursive algorithm to enumerate the possibilities.

Start at the beginning and list the possible symbols formed by consecutive dots and dashes. In our case the possible symbols are T, N, K, and Y. So the possibilities are

  • T (-) added to the front of all sequences that start with .---.----..
  • N (-.) added to the front of all sequences that start with ---.----..
  • K (-.-) added to the front of all sequences that start with --.----..
  • Y (-.--) added to the front of all sequences that start with -.----..

So for the first bullet point, for example, how would we find all sequences that start with .---.----..? Use the same idea.

  • E (.) added to the front of all sequences that start with ---.----..
  • A (.-) added to the front of all sequences that start with --.----..
  • W (.--) added to the front of all sequences that start with -.----..
  • J (.---) added to the front of all sequences that start with .----..

So pull off all the symbols you can from the beginning of the list of dots and dashes and in each case recurse on the rest of the list.

Related posts

Helmholtz resonator revisited

We finished a bottle of wine this evening, and I blew across the top as I often do. (Don’t worry: I only do this at home. If we’re ever in a restaurant together, I won’t embarrass you by blowing across the neck of an empty bottle.)

The pitch sounded lower than I expected, so I revisited some calculations I did last year.

As I wrote about here, a wine bottle is approximately a Helmhotz resonator. The geometric approximation is not very good, but the pitch prediction usually is. An ideal Helmholtz resonator is a cylinder attached to a sphere, and a typical wine bottle is more like a cylinder attached to a larger cylinder. But the formula predicting pitch is robust to departures from ideal assumptions.

As noted before, the formula for the fundamental frequency of a Helmholtz resonator is

f = \frac{v}{2\pi} \sqrt{\frac{A}{LV}}

where the variables are as follows:

  • f, frequency in Hz
  • v, velocity of sound
  • A, area of the opening
  • L, length of the neck
  • V, volume

The opening diameter was 2 cm, the neck length 9 cm, and the volume 750 cm³. All these are typical. The predicted frequency is f = 118 Hz. The measured frequency was 106 Hz, measured by the Sonic Tools phone app.

The actual frequency was about 10% lower than predicted. This is about a whole step lower in musical terms. I could certainly hear an interval that large if I heard the two pitches sequentially. But I don’t have perfect pitch, and so I’m skeptical whether I could actually notice a pitch difference of that size from memory.