##
Archive for **October 16th, 2022**

*“Music is the pleasure the human mind experiences from counting without being aware that it is counting.”*

— Gottfried Wilhelm von Leibniz (1646–1716) (co-discoverer of calculus)

Harlan Brothers. Mar 29, 2022

The connections between mathematics and música run deep. The subjects can be thought of as cosmic twins, born out of a tantalizing **mixture of order and disorder**.

They both grow from foundations that are built on patterns: **patterns made up of repetitions, ratios, **number sequences, geometrical transformations, symmetries, combinations, variations, and more.

Music is, at its core, based on numbers and mathematical relaciones.

By the same measure, numbers and mathematical relationships can be transformed into music. To explore the many connections in detail, we would need to explain the core terminology of each field — far more información than would fit in this brief article.

We will therefore touch on a few important relaciones that will establish a foundation if you’re inclined to dig deeper.

## Musical Sound

On the most basic level, musical sounds are not just “any ol’ sounds.” The screeching of auto brakes, the rustling of leaves, or the thud of an Amazon caja at the front door are not what we en general think of as being musical. So, what makes a sound *musical*?

It turns out that **melodic instruments**, like the guitarra or flute, make the surrounding air vibrate in a very **orderly pattern** (apologies to my drummer friends— no percussion discussion here).

Each note is actually a whole familia of vibrations with a** primary vibration that we call the “pitch.**” The frecuencia of the primary vibration is called the *fundamental*. We’ll abbreviate it with the letter *f*.

Looking at Figure 1, the note A below middle C on the piano has a fundamental of 220 hertz (abbreviated “Hz”). That is, when you play the note, it makes the air vibrate 220 times per second. It also makes weaker vibrations at 440 Hz (2 *f*), 660 Hz (3 *f*), 880 Hz (4 *f*) , 1100 Hz (5 *f*), and higher.

As we see from the formulas in parentheses, these additional frequencies are all **multiples of f**. They are called

**and their relative strengths are one of the main reasons we don’t confuse a bagpipe with a banjo.**

*harmonics*For reference, **youthful human ears can hear frequencies up to about 20,000 Hz.**

Together, the set of harmonics form what musicians call the *harmonic series*. It turns out, mathematicians have their own, related harmonic series. For them, it is one of the building blocks of calculus and higher mathematics.

Here is the mathematical harmonic series which is written as the **sum of the reciprocal of the natural numbers:**

The “…” at the end of the series above is called an *ellipsis* and signifies that the series continues to infinity.

Looking at the** denominators **of this series we see they are the same as our multiples of *f . *The two harmonic series are related in that the pitch of a vibrating string is **directly related to its length**.

If you hold a string down at its **midpoint** on the neck of the instrument, you are dividing the length in half.

Plucking it, you’ll find the pitch has doubled in frequency (*f* becomes 2 *f*). Divide it down to 1/3 of its original length and *f* becomes 3 *f*.

The “1/2” in the mathematical harmonic series therefore corresponds to the “2 *f* ” in the musical harmonic series, the “1/3” to “3 *f* ,” and so on. It represents, in effect, the fraction 1/n of the starting length that is allowed to vibrate and which results in a frequency of n *f.*

The musical harmonic series, of course, cannot continue to infinity — the physical properties of air along with those of the wood, nylon, metal, and plastic that form instruments are limiting factors — no physical object can vibrate infinitely fast. Nonetheless, the harmonic series is a pattern that is fundamental in both music and math.

Now, to answer our question, unlike melodic musical sounds, random sounds and noises lack the orderly frequency structure corresponding to the harmonic series. We see that the very fact of being a *musical* sound corresponds to an underlying mathematical pattern: {1 *f*, 2 *f*, 3 *f*, 4 *f*, 5 *f*, …}.

## Notes and Scales

So, what can we do with the math-based, musical sounds we call “notes”?

We can build musical scales. Every scale is defined by numbers. In Figure 1, a section of the white keys on the piano is numbered 1 through 8. These correspond to the C major scale: C, D, E, F, G, A, B, followed by C again (where the scale repeats).

The distance between any two of the same note, like from C to C, is called an** octave**. Musicians often refer to notes using their numbers. For instance, the note E is the “third degree” of the C major scale.

There is a simple rule that lets us build a major scale starting on any note. The rule is based on the division of the octave into** 12 equal parts called semitones**. A semitone is the distance between any two adjacent notes on the piano.

Mathematically, a major scale can be represented by the pattern of semitones {2, 2, 1, 2, 2, 2, 1}. Start on any note and count up according to this rule and you will produce a major scale.

For comparison, the “harmonic minor” scale is defined by the rule {2, 1, 2, 2, 1, 3, 1} and the “**pentatonic**” scale is defined by the 5-note rule {2, 2, 3, 2, 3}.

There are a surprising number of scales we can construct using such mathematical rules.

**Nicolas Slonimsky** 1947 book the *Thesaurus of Melodic Scales and Patterns* lists more than **1,600 different patterns,** many of them mind-boggling even for accomplished musicians.

Knowing how scales are made, we can take the next step and **construct chords **(three or more notes played at the same time). Three-note chords, called “triads,” are built by using every other note in a scale.

Looking back at Figure 1, the chord built on the first note of the C major scale is made up of notes 1, 3, and 5 (C, E, and G) and is called a **“C major chord.”**

The chord built on the second note of the C major scale is made up of notes 2, 4, and 6 (D, F, and A) and is called a** “D minor chord.”** For every scale, an incredible variety of chords can be constructed by using patterns of note numbers.

It’s important to point out that the semitone-based scales we are talking about belong to the tradition of what we refer to as *Western* music.

**Other cultures divide the octave differently**. For example, much of Middle Eastern music uses **an octave that is divided into 24 parts.**

We’ve touched on the mathematics of notes, how scales are constructed from notes, and how chords can be constructed from scales.

There are many other important aspects of music such as** rhythm, meter, harmony, counterpoint,** and song structure that are deeply rooted in mathematics.

It is also worth mentioning that if you use a software** audio player** that has a song visualization module, the animation you see is generally based on mathematical analysis that measures the frequency content and the changing volume in a song.

*Music from Math*

*Music from Math*

How about creating music from math? Countless books, articles, and research papers have been written on the subject. In fact, for centuries, mathematical techniques have been used by famous composers like Bach and Mozart (and many not so famous composers) to help develop their ideas or establish the structure of their compositions.

The dawn of the computer age opened a new era of **composing based on mathematical rules**, assigning pitch values, note duration values, and volumes to numbers generated by specialized programs.

This type of music covers an extraordinary range of styles and is generally referred to as *algorithmic composition*. Here is an example of an algorithm that produces fractal music.

Even without a computer, you can **convert numbers directly into music. **

For instance, we can extend our C major scale in Figure 1 up two more white keys and assign the numbers 0 through 9 to those ten notes. We can then read the digits of any number and simultaneously play the note corresponding to each digit.

If we use first **eight digits **of the never-ending constant pi=3.1415926…, we would obtain the melody {E, C, F, C, G, D, D, A} (notice that the two appearances of the note D are an octave apart). Here is a fun example of this approach:

More sophisticated techniques are also possible. For ejemplo, below is an animation of a composition of mine called **“100 Seconds of Pi.**” In it, all pitches, durations, and dynamics in **each of the six voices are derived from pi.**

In this case, a visualizer is using sophisticated mathematics to analyze the number-derived music and translate it into graphics.

Here we can witness the dance of the cosmic twins — math is transformed into music for our listening pleasure and from music into math-based animation for our visual enjoyment.

https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSNpab2PDquw%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSNpab2PDquw&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSNpab2PDquw%2Fhqdefault.jpg&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=youtube**See the YouTube description for details about how this music was composed.**