# The Mathematical Problem with Music and How to Solve It — “Performance is an art of compromise” – Temperament, timbre, intonation, tuning, voice, tone

## The Mathematical Problem with Music and How to Solve It

Equal Temperament purpose — Divide octave into 12 equal intervals (ratios) to facilitate octave transposition on keyed / digital / discrete instruments.
VIDEO DESCRIPTION / NOTES
There is a serious mathematical problem with the tuning of musical instruments. A problem that even Galileo, Newton, and Euler tried to solve. This video is about this problem and about some of the ways to tackle it. It starts from the basic physics of sound, proves mathematically why some musical instruments can never be perfectly in tune, and then introduces the main solutions that were proposed to solve this problem, along with their upsides and downsides: Pythagorean tuning, Just intonation, the Meantone temperament, and finally – the equal temperament, which is the tuning system almost everybody uses today in the West.
To learn more about the connections between music and mathematics, I highly recommend the book “Music – A Mathematical Offering” by David Benson. This terrific book is a treasure trove of information, extremely well written, and its thorough discussion of temperaments is just one of the many topics it covers. The book can be downloaded legally and for free from here: https://homepages.abdn.ac.uk/d.j.benson/pages/html/maths-music.html

Sevish is a master of electronic microtonal music. His compositions, despite their ominous genre, sound light and fun. Check him out. https://sevish.com

Paul Davis explaining how and why John Frusciante (of the Red Hot Chili Peppers) “mistuned” his guitar in the song “Scar Tissue”

A Madrigal by Nicola Vicentino (1555), played on a 24-tone harpsichord tuned in meantone temperament, by Johannes Keller.

A concise introduction to Arabic music. Pay attention especially to the Albayati, Alsaba, Alsard, and Ahuzaam maqams, with their intense microtonality.

The Lumatone Isomorphic Keyboard is a cool interface to microtonal music.

Yehezkel Raz, the Ableton wizard, for transforming me from a complete Ableton noob to a good-enough user in less than two hours. https://yehezkelraz.com

Dina Lurie, a dear neighbor and a great violinist (in the Irish fiddle tradition!), for contributing two notes and one double glissando. https://www.facebook.com/dina.lurie
Alon Schab, a musicologist, and also a friend, bandmate, and academic colleague, for advice on some musical and historical issues. https://haifa.academia.edu/AlonSchab ——————

The intro and outro music is “Snowfall Butterflies” by Asher Fulero (via YouTube Audio Library). https://asherfulero.com

The flute and Qanun sound samples are from FreeSound. https://freesound.org

Photo of the Antegnati Organ in Santa Barbara, Mantua (1565), courtesy of the organist Simon Lloyd. https://simon-lloyd.com

=== Contents ===
00:00 – Intro
00:44 – What is sound?
02:42 – Melodies
04:48 – Intervals
07:00 – Choosing frequencies
11:56 – Pythagorean Tuning
14:33 – Just Intonation
18:36 – Meantone Temperament
24:34 – Equal Temperament
29:50 – Other temperaments
31:09 – Outro

The sound samples were prepared with Ableton Live 11. To make them piano-like but still as accurate as possible, I used the physical-modelling Pianoteq plugin, with the unison width set to 0, octave stretching ratio set to 1, string length set to its maximum value (to minimize string inharmonicity), hammer noise set to 0.5, pedal noise set to 0, and the velocity-to-dynamics curve considerably lowered (ending at mezzo-piano).

Created by Yuval Nov for the 2022 “Summer of Math Exposition” (SoME2) competition, hosted by the one and only 3Blue1Brown (Grant Sanderson).

Fun fact: violinists frequently use all three systems: pythagorean, just, and equal temperament. We tune the instrument’s strings according to the perfect 3:2 pythagorean fifth and usually play single lines without accompaniment wholly in the pythagorean system, as the whole steps are wider and the half steps are narrower, giving melodic lines more direction. When playing chords, or playing with other instruments which also use pythagorean tuning (like other stringed instruments), we often will adjust certain notes to just intonation to avoid clashing. We try to avoid adjusting melodic notes this way, instead preferring to adjust only the harmony notes. When playing with equal temperament instruments like piano, if there are any long sustained notes where the intonation difference and resultant clash will be clearly noticeable, we occasionally adjust to equal temperament for just a moment to avoid this. Performance is an art of compromise!

Fun fact: Other instrumentalists do that too. Even rock musicians. I regularly detune my G string to make accompaniments using power chords sound better for instance.

Equal temperament without any just interval permit to keep a permanent place for ALL notes. To try it you must avoid the just fifts-A/E can stay just because E is metalic and will go down itself. But D cord must be tuned maximum hight possible. The same for G string. The difference is very small. Each interval must be modified respecting follow rules: 1/unisson =just, 3minor=smaller, 3major=bigger, 4=bigger, 5=smaller, 6minor=smaller, 6major=bigger, 8=bigger. How much? It’s you who decide! The direction of modification is important only.

Violinist: I can actually dynamically adjust from songs to songs without re-tuning the violin because violins have no frets. Guitarist: I can also in a way micro-adjust, songs to songs, by doing slight bends or pressing the strings between frets a little heavier or lighter. Pianist left the group.
And some violinists lacking good “temperament” REFUSE to play near a piano which is a percussion instrument
The mathematical concept to change from one key melody to another has been fixed for the piano since Bach‘s time. It needed a compromise which nobody actually disturbs. So the violin takes care of the piano notes. Anyhow orchestras sometimes change the frequency of note a to 335 as mostly done in the Vienna Philharmonic orchestra.

To stay in tune you must do constant compromis avoiding all pure intervals!
piano uses equal temperament so the interval of the third is not music. The violin can play properly. The piano is a percussion instrument meant for banging on strings with which you have no human contact.
before the advent of electronic tuners I used the harmonics method of tuning my guitar, and always detuned the G string slightly. Even with fancy dancy electronic tuners, I still check by ear.
Fun fact : In professional orchestras, musician change the tuning of each notes dynamically to get “just intonation” sounds, in particular they will slightly decrease a third and slightly increase a fifth.
I’m a piano tuner. I’ve read and seen many explanations on this subject. This is the best and most intuitive description of tunings and why I’ve seen yet. The math concepts here have made the separate tunings including equal temperment so much more understandable. Thank you so much!
This is genuinely one of the best explanations of musical temperaments I have ever seen. Amazing!
Great video. Just one suggestion which I think would be really useful is to show the wave interference when the ratios don’t quite work. A visualisation of the ‘messy’ waveforms really helps explain a lot as to why we hear the dissonance and feel it as so jarring.

DISSONANCE OF BEAT FREQUENCIES When you mix frequencies together you end up with the cross-Cartesian product of all of the sums and differences of the frequencies being mixed. So, if I mix two frequencies A and B together, I end up with four different frequencies: A, B, A+B, A-B (or B-A if B should be larger). In time domain graph of the waveform, you would simply see one frequency superimposed over another similar to images depicting an AM modulated waveform.

The reason that two sounds close in frequency mixed together sound “messy” has to do with how humans perceive low frequency sound. Your brain has to have some mechanism to determine what sounds are tones and which sounds are individual reoccurring events. The cut-off happens somewhere below about 50 Hz.
You can imagine a mechanical buzzer or bell (like a school bell) happening every second. You mind will hear the individual ticks. As you turn up the frequency you will hear the ticks/dings getting faster and faster together. At some point as the ticks/dings get faster, your mind will stop interpreting them as individual ticks/dings, they will start to run together, and you will start hearing them as a single tone — albeit with the kind of undulating, buzzing overtones that are generated by a square wave. The reverse happens as you decrease from a high frequency passed 50 Hz until the frequency starts to sound like individual ticks/dings again.
The same thing happens with when pure tones are mixed together. When the A and B frequencies are more than 50 Hz apart, you can hear the A-B/B-A component as it’s own separate tone. As you move A and B closer together the A-B/B-A component crosses the threshold, stops sounding like it’s own tone, and instead starts sounding like an undulation of the A and B frequencies. If you get A and B to within 1 Hz of each other, they will sound almost like a single tone together but they will drop in and out every second as the A-B/B-A wave rises and falls.
This is the origin of the “jarring” “dissonance” that you hear. It is like listening to a radio station that is rapidly fading in and out with a constant hidden “beat.” That is why the sum and difference frequencies are sometimes referred to as the “beat” frequencies.

This is one of the best outlines of scales, intervals and temperaments I have seen on line. Some historical perspective, just enough to explain the new demands due to harmony singing, or modulation, but not going into excessive and misleading detours that you get so often in explanations of musical scales.  [Nice how] you point out clearly that equal temperament is a necessary compromise and not a perfect solution.

As a music major who used to do engineering, this is such an amazing intro to the niche rabbit hole of tuning theory. Avant guard composers of the 21st century often break the idea of 12 notes per octave (the term is 12EDO or 12 equal divisions of the octave) and pushing boundaries by writing music in tuning systems like 19EDO (19 because it has a ratio that is really close to 5/4 (important in music writing) making it pretty stable if used accordingly).
This is an outstanding presentation, clear, precise, not dumbed down, interesting and fascinating. My sense of hearing has been so thoroughly, unequivocally determined by equal temperament that everything else sounds “wrong” to me. I am a pianist and don’t have the ultra-subtle hearing of violinists. I will read the recommended book.
Equal temperament was already proposed (and probably used) on the lute in the 16th century – among others by Vincenzo Galilei, father of Galileo Galilei. The first compositions through all 24 “keys” were written by Giacomo Gorzanis in 1567. Today many lute players (Renaissance lute) use 1/6 comma meantone tuning.
For those interested in a modern use of the Pythagorean tuning, Mickey Hart from the Grateful Dead developed an instrument called “The Beam” that is tuned to a Pythagorean monochord. It is basically a 12 foot piece of metal with piano wire stretched accross it, amplified by giant guitar pickups. It produces the greatestfrequency spectrum of any instrument. Although it is best appreciated live, amplified by the Dead’s always most-advanced-sound-system-on-Earth-at any-given-time,there are some pretty astonishing recording online, particularly Wake Up To Find Out, “Drums”
I don’t think I’ve seen such an elegant explanation of these concepts. I really enjoyed your explanation of the rationale of each tuning system, and their benefits and shortcomings. I often find people become too preferential, glossing over the problems of their favorite system to make it seem better. This was a lovely video to watch, thank you!
You have done a GREAT job with this video!! I don’t think very many people will ever understand how many years of music theory you combined into a half hour video. This is like the “Meru” of Music/Math videos.

One thing that could have been explored a bit more (perhaps) is the reason why small integer ratios sound more harmonious, and how that’s literally connected to constructive and destructive interference in physical waves. For example, a brief audio & visual representation of how ‘beats’ form when two notes slightly off-tune from each other are played.   29:34 The transposition of the melody here actually sounds great past the first chord. The final dominant 7th chord is more in-tune with the harmonic series, being constructed of 5/4, 3/2, and ~7/4. The preceding chord is a minor chord with a lowered minor third based on that 7/4 interval.   11:50 — Equating a Temperament with a Tuning is a common mistake, but in fact not quite correct! Temperaments a subset of Tunings ; all Temperaments are Tunings but not all Tunings are Temperaments! A temperament is a scheme for adjusting pitches from their exact-integer-ratios. So, Pythagorean and Just Intonation are Tunings, but they are not Temperaments, because they use exact integer ratios. Equal-Temperaments, Meantone Temperaments, and Well-Temperaments are temperaments. They have deliberately and systematically adjusted their pitches away from exact whole-number ratios. 18:37 — Minor Historical nit: Meantone Temperaments were much more common in the mid-late Renaissance than in the Baroque, by which time Well-Temperaments began to take over (and persisted into the mid-late 1800s, BTW — longer than most people realize).

However, any instrument with a soundboard/sounding box, if multiple tones are played, will automatically improve the ratios, due to the principle of resonance. The same key on the piano can provide slightly different pitches, depending on what other notes are being played (of course this varies based on the manufacture of the piano).

>> I read “resonance” in this comment as “ultra-complex inter-play of resonances, creating in fact subtle nodal / anti-nodal added frequencies that altogether comprise the musical ‘timbre’ or ‘voice’ of the instrument.” — This may explain why unlacquered drums (and even sticks!) sound so wildly different from heavily-coated ones; or why a Strad is so highly prized. The same is true in electronic amplifiers and veers strongly into the realm of TIM distortion and generally intermodulation.

Very good explanation – this should be shown in schools for music students starting music theory.

>> The ultimate problem is digitalia which removes all heart and soul and feeling from music so muddled and reproduced. It turns out that the micro-anomalies, errors, perturbations are in fact what makes music lovely and musical performance (and performers) indispensible. MIDI did not ‘oust all drummers’ as was initially predicted and in fact proved the opposite need. Autotune makes its hallmark awful mark routinely. “ProTools sound” has become denigrantly well-known amongst recording engineers. “Perfection” is always an aspiration and never an attainment, IMO.

Oh, man! You made my day! I’ve been waiting for that explanation for the past 50 years, since when at music school, I said to my piano teacher that violin played along the piano constantly and always sounds out of tune to me, no matter who plays and on which particular instruments (to what the teacher replied that all was good and I must be tone-deaf or something 🤣). Well, now everything makes perfect sense. Apparently, I wasn’t that deaf.
>> This proves one must always skeptically doubt and beware all “teachers” as nearly none know enough, and zero know all.  Too bad your teacher imparted kernel of self-doubt to you in this instance instead of curiosity and wonder.
I learned so much from this video – math, music theory, what is a ‘howling fifth’ (which I had heard of but never really understood), music history . . . A true plethora of knowledge, a multi-discipline smorgasbord!
Been trying to find all this information put together in a single document for 2 years now, very greatful you ‘ve done that in this video. Great job! This is the best “engineering-minded” description I’ve found of how we ended up to the equal temperament. The video is well structured, and presents all the key elements that lead to the the modern equal temperament tuning. The exposition speed is also adequate (it is, not too fast) so that all the “how’s” and “why’s” can be absorved and understood more or less in real time. Very informative to understand an essential component of music: harmony.
In Indian classical music, we have something called “Shruti”, which are 22 in number. 12 of them are picked as the main notes. In some prices, some shrutis are used, giving it a different mood. A musician can pick the notes as per his compositions and needs.
Another reason octaves are psychologically perceived as the same is that men’s and women’s voices are on average about an octave different, so if a man and a woman sing the same melody together it’s extremely likely they’ll end up an octave apart. The high parts of the melody will sound high in both voices, and the middle notes will be in the relaxed center range of both voices. The experience of trying to sing the same melody with someone else and both being comfortable an octave apart is something most group singers have had.
What can be said more about the practicability of the historic tunings is that they were designed to serve a particular composition (piece of music), in a particular tonality (key), with a particular distance of modulation inside (maximum three fifths, up or down). To further play another musical work of a different tonality (and specific modulations inside) on the same instrument (we talk about a fixed tuning keyboard instrument), that instrument required to be retuned accordingly. Don’t make a panic attack (or financial stroke), tunings in those days were much easier to accomplish, much faster, and almost any serious keyboard player did it himself, like violinists and harpists nowadays. Reasons for that comes from less accuracy – the instruments themselves were technologically less perfect and thus their sounds were significantly falser (inharmonic) than in later pianos -, and the number of strings also significantly fewer. The equal temperament in use in our times came out of the need for a complete tonal freedom of modulation in musical works, as well as being able to play any composition, in any tonality, without having to make that ruining (or bankrupting) call to the piano technician…

Well, thanks for the informative video. The equal temperment has not only the octave as a geometrically sound interval but also the tritone that the dominant-seventh chord is the best tuned chord on the piano with its notes only a hair above what the seventh and leading-tone should be. This changed music drastically in that the dominant-seventh gained in popularity. The out-of-tunedness of the piano is compensated by the deeper and less harmonic notes of the bass overpowering the difference-tones of the above notes. Singing instruments and singers fluctuate their notes within a pitch range in order to accommodate the exigencies of the harmonic movement. Tones which occur simultaneously would otherwise form dissonances with the actual harmonies. Using your a=440hz a c# would need (on the flute for ex.) to be 550hz in order to produce a difference tone of 110hz (or an A’). at the same time, this c# combines with an e”=660hz in order to produce an A’=110hz. The a’ played together with the e” produces an E= 330hz. Should one of the harmony notes not have this geometry to the tonic, the chord would sound horrific. The higher the instruments are playing, the easier this is to hear this. The aformentioned c# changes its pitch as soon as a g” is introduced, bending higher to what’s called a leading tone to c#’= 556hz, while the g” is a geometric fourth (4/3) above the d’ which is also a 5th below the a’ (g = 391hz). The difference tone produced between these two notes g (391hz)and c# (556hz) is an E = 165hz, fitting with the 110hz = A’ perfectly consonant in the harmony. Walter Piston illustrated this phenomenon with a contrabass playing first the C# of an A-major chord and adding the septime and watching the visible raising of the bass-note C#. The Juilliard String Quartett with Bob Mann as the first violin experimented with playing tempered for about 10 years from the mid 50s (heard on many recordings) but stopped this practice due to intonational differences. The Guarneri (David Sawyer as the cellist) thought that they were playing “wide” thirds but I showed them that this wasn’t so – they were indeed playing in-tune using what I call “Integrated Intonation”.

this is exactly the video I was searching for a long time. there’s many sources that contain some information on the exact physics of how temperaments work, but this is the most substantial video on the subject.
When I was in a boys Choir, when we sang A-Cappella, we often ended up in a slightly lower key than the one we started at. I think this has to do with thirds; If kid 1 sings C, and kid 2 joins with E, the E will probably be a little bit flatter than equal temp’s E. If then kid 1 goes down to A, to create a Fifth with the ongoing E, his A will be flattish too, because the E is flattish. and so on.
It is worth mentioning the “53-temparement”, division of the octave into 53 microintervals (2^(1/53)). which are very close to a syntonic comma (81/80 = 1.0125). In this system, the major scale has intervals of 9+8+5+9+8+9+5 microintervals. This system approximates the just intonation so well that the difference is not audible (third and fifth are both a tiny bit lower, respectively by 1.7 and 0.07 cents, a difference which I think nobody can hear, and the microinterval is just 1.14 cent above the syntonic comma). With this system, transposing one fifth amounts to raise one note (the sixth degree) of one microinterval (a comma in the just intonation model), in addition to raising the 4th note by adding a sharp. For exempla, transposing from C to G, you change F to F♯ and A to A+, where + means adding one microinterval. None of the other models can achieve such good approximation of the just intonation and ease of transposition (but still needing extra keys or extra modifiers…)

>> One of JAN IRVIN (LOGOS MEDIA) many interviews with Dr Hans Utter notes 57 notes in the octave of Indian music played on Sitar.

This the type of stuff you pick up over years of training and practicing in music, and/or by studying the science of it— and he just clearly laid it all out in 30 minutes…
This is a great music theory lesson, one of the best and most accessible I’ve ever heard.
Equal temperament allowed us to make technical improvements as well. Before, fretted string instruments had movable gut frets to be able to retune according to the key. With equal temperament you can have fixed metal frets (and metal strings that otherwise would destroy gut frets).
My violin teachers required my learning to hear and play eleven overtones/ harmonics per string, then tune ‘third’ tones from all fingered or strummed chorded multiple notes. On a great violin these extra resonance notes are so loud as to project hundreds of feet echo off buildings in NYC and be heard over a full orchestra. Then I studied piano tuning and found books of competing tuning methods of hundreds of various mathematical models. I learned that well tempered clavier style of tuning and modern violin tuning was the result of loud wind instrument playing with soft unison perfect pitched gut string instruments. It turns out our human ear easily compensates for the distortion and completes the ideal harmonics internally. The human ear hears the high and low registers the piano as sharper and flatter again adding more complexity. Modal music was often limited to vocal ranges, but well tempered tuning allowed non vocal unsingable music to develop. Then I studied North Indian classical. With 25 to 38 strings tuning in unison/one chord for all instruments playing on typical instruments, the resulting purity of overtones music is again fundamental and vastly creative. Finally the sliding of Intervals in this style is music is like calculus where millions of tiny notes limited only by the master musicians ability because the rigor of the master and focus of student ardent practice. Imagine if every pianist had to first tune their piano every time they played? And then all the keys can slide around and must be kept in tune by individual finger pressure? Early western string music was one giant chord including the room itself. Music engineers now do the same with software and use actual walls of wool, silk, stone to create certain overtone sounds.
I think that’s the most I’ve ever learned about music in 30 minutes.
This is exactly the explanation I’ve been seeking for many years.
We never use equal temperament 🙂 Small correction: extra keys on the keyboard are not originally baroque, they began in the early renaissance, even before music printing. Zarlino dates from the 16th century and tastini–extra frets–also.
I am a person who sees a color-shape for each note. I also only record at A432 Hz or A440 hz Schumann Resonance. Because i like to keep thing numerically even and harmonic. (Sacred Geometry, The Golden Mean, etc). That being said, I have always tuned my own pianos. I’d always meditated on how I could make a better tuning. I also found it strange that Well-Tempering is not added to synthesizer pre-sets. They have historical Valotti Tuning, Kernberger tuning, Mean Tuning, etc. Why no tuning back to the Bach “Well Tempered Clavieir.” Well, someone has, I think, beat me to the punch. A theorist names Robert Edward Grant has come up with what he calls “Precise Tuning.” And it’s sound better than equal temperment (which is what we use today) .And that’s a HUGE deal // I’m still tying to figure out he did this, but I realized that what he did was create a variation of Well Tempering. Well Tempering is type of tuning that is close to Equal Temperment, but it has deviations in it that wind up when different keys actually having different colorings. Meaning, if you played a song is C, it wold have it’s own tuning quality, but if you played it again in C# it would have a slightly DIFFERENT quality of tuning. That’s all i can say about, but, but I did want to mention this, essentially brand-new tuning, Precise Tuning. // For anyone interested it observing my note-to-color music theory, do check me out here on uToob at: The Acoustic Rabbit Hol
The fifth was considered an important interval for melodies way back in time, when our musical development was only at its start. Today, the fifth is actually not considered a particularly useful interval for melodies and harmonies, only for chords. In the equal temperament tuning, the major third (and minor sixth) are not even the biggest problem. The minor third and major sixth are 0.9% off the pure interval and the minor seventh and septimal minor third are even 1.8% off. Also consider all the other possible just intervals – nuances that cannot be expressed in equal temperament. The problem of insufficient tunings doesn’t exist in electronically generated music (and by the way, in a cappella music). Thus I don’t understand, why everybody went on making electronic instruments with the artificial limitations of most of their acoustic counterparts (and is using autotune to get back to equal temperament).
Very nice and informative video, many thanks. About 24 microtone scale of Islamic countries, I should say that (at least for Persian music) this theory is rejected by exact measuraments done by Iranian researchers. For example see the book “Dastgah concept in Persian music” by Hormoz Farhat (Cambridge university press 1990)

So, I built a guitar about 55 years ago. I knew how long my fingerboard was and so I knew where I wanted to put the fret for the first octaves (which I know as the first harmonics). On the other hand I didn’t have any idea if I was going to tune the open strings to the right frequency – though I would of course tune the strings to each other – so I guess I was going to transpose just about everything until I got that right! That more or less forces me to go with 12 geometrically equal intervals and it seemed so obvious that I simply got out the log tables – yes, that long ago, big shout out to John Napier here – and worked out where to cut my fingerboard for the frets. It seemed so obvious at the time, I never thought there could be any (sensible) other way, so that’s very good to know now.   This is the no-nonsense music theory! Many called themselves teachers in music theory are priggers, get your tuition and gave a lot of crappy terminologies…ruined many in music schools…

There is no mathematical problem with music. There is a problem with the design of many musical instrument that have speaking devices that are tuned to a fixed frequency, and equal temperament is a mathematical solution to the problem how to tune them to a compromised or “tempered” tuning so that they can be played in every key, without first having to be re-tuned. There are other mathematical solutions but 12-tone equal temperament is the one that is most often used today. It was developed, I think, a few hundred years ago.. At any rate, it has been used for a long time.