I'm a developer, and I'd like to have some constants such as Major Thirds (5 / 4 = 1.250), Perfect Fourths (4 / 3 = 1.333) and Augmented Fourths (? / ? = 1.414).

Could anyone help me find what is the proper calculation and maybe recommend me some tags for this question. Thanks!

I asked this on MathOverflow but got sent here to ask my question.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Dom
    Mar 25, 2021 at 22:51

9 Answers 9


1.414 is actually the approximation of the square root of 2.

In fact, as the tritone article on wikipedia reports:

In twelve-tone equal temperament, the A4 is exactly half an octave (i.e., a ratio of √2:1 or 600 cents)

So, there's no integer ratio, it's just √2.

Depending on the platform and language, you can get the floating point approximation anyway.

For instance, in Python:

>>> from math import sqrt
>>> print(sqrt(2).as_integer_ratio())
(6369051672525773, 4503599627370496)
  • 14
    I realize the question is not tagged as just intonation, but it does mention 5:4 and 4:3, frequency ratios, strongly implying that equal-tempered calculations based on the 12th root of 2 are not the solution...
    – user45266
    Mar 24, 2021 at 23:53
  • 2
    @user45266 Yes, you're right: I should probably specify that (I was thinking about it, actually). That said, the OP was introduced as a dev, and considering that subject and its implications (which are often based on standardized assumptions) I thought that they probably don't need a specification based on tuning, but just as a reference, especially considering the last request. It's not uncommon to use some level of approximation (just like equal temperament is) in computing; consider that floating point numbers are very often an approximation, especially some of the most simpler ones. Mar 25, 2021 at 0:52
  • 4
    For instance, ((1 - .1) / 3) * 3 (just like 0.3 * 3) should be 0.9, but in many systems and programming languages/libraries, it actually results in 0.8999999999999999 (which is a visual representation very close to the actual value if we consider that repeating 9, but still not the correct result). In fact, 0.9 == 0.3 * 3 (which means: "is 0.9 equal to 0.3 multiplied by 3?") actually returns False. Mar 25, 2021 at 0:55
  • 1
    I use those ratio to setup font-sizes and relationships between headers and paragraphs for example, I hope this doesn't anger anyone! But I love beautiful numbers.
    – ClubMate
    Mar 25, 2021 at 14:02
  • 2
    @ClubMate This may nullify the premise. In an instrument with an oscilllating linear string or linear air volume (but not so in drums, gongs, etc.!), a sound is not a simple sine wave but a mix of a base frequency an harmonics at 2x, 3x, 4x the base frequency, Two such sounds are considered in harmony when they blend into one because they share a lot of these frequencies (in particular among the most relevant ones). Therefore simple fractions are "good". In viusal arts, one rather deasl with the golden ratio - the most irrational of all numbers (though this is up to taste) Mar 26, 2021 at 7:50

It depends on the tuning system.

For example a major third is 5/4 or 1.25 only if you're using 5-limit just intonation. In pythagorian tuning it's 81/64, in twelve-tone equal temperament (i.e. normal piano tuning) it's close to 1.256, in septimal tuning it's 9/7, so on and so forth.

What makes 5/4 the major third is that it is the simplest ratio that we recognize as a major third.

Augmented fourth has similarly many definitions. Wikipedia lists many such ratios that could be called a tritone (another name for an augmented fourth in some tuning systems): 729/512, 1024/729, 25/18, 36/25; 45/32, 64/45, 7/5, 10/7, 13/9, 18/13.

This time there's no clear answer as to which is the augmented fourth. Because even if 7/5 is the simplest ratio, the western musical tradition seems to be based on 5-limit intonation (where the highest prime factor of the integer ratios is expected to be 5) and 7 doesn't play well with our scales melodically.

One possible contender is the interval between F and B in a 5-limit just intonation C major scale composed of just C, F, and G major chords as defined here, which is 45/32. After all, it is a fourth (F-G-A-B, four steps) and it is augmented (larger than perfect fourth 4:3).

  • Well, 7/5 or its inverse "clearly" looks the simplest to me, the problem of course being that the 7th harmonic has no place in normal 5-limit Western music theory, so you can't musically construct that ratio from scale tones or even accidentals.
    – user28245
    Mar 25, 2021 at 11:52
  • @obscurans And it is "clearly" the best sounding harmonically when in isolation but it is hard to place in a diatonic musical context (which seems to be mostly based on 5-limit intonation).
    – cyco130
    Mar 25, 2021 at 11:56
  • 1
    we agree on the reason, the harmonic 7th is 30+ cents off any 12EDO interval, so it's effectively unusable (the dominant 7th is completely unstable and musically used that way - for its tendency for resolution).
    – user28245
    Mar 25, 2021 at 11:58
  • Mind, I've played with 4:5:6:7 pure sine waves, and it just doesn't sound that stable to me either, so who knows.
    – user28245
    Mar 25, 2021 at 12:04
  • @obscurans I updated my answer to address your point. But I have to tell you, 4:5:6:7 sounds pretty consonant to my ears. Especially if were talking about sine waves it just sounds like 1 (the missing fundamental) would sound over a low band phone line.
    – cyco130
    Mar 25, 2021 at 19:04

Just intonation sounds good, but leads to contradictions.

You are applying what is called "just intonation" where idealised ratios are used.

If a major third is 5:4 and an octave is 2:1 then a major third plus two octaves is

(5/4) x (2/1) x (2/1) = 5:1 (or alternatively 80:16)

If a perfect fourth = 4:3 and an octave is 2:1 then a perfect fifth = 3:2.

hence four perfect fifths = (3/2)^4 = 81:16

but these are both 28 semitones!!

This ratio 81/80 is known as the syntonic comma.

Similarly, twelve just perfect fifths (3/2)^12 = 129.74 which differs from seven octaves 2^12= 128 by a ratio known as the pythagorean comma.

The modern "standard" solution to this problem is equal temperament.

This means the octave is split into 12equal semitones, each with a ratio of 2^(1/12) (the twelfth root of 2.)

Then we have:

Major third = 2^(4/12) = 1.2599 (differs quite a bit from the ideal 5:4 = 1.25)

Perfect fourth 2^(5/12) = 1.3348 (differs slightly from the ideal 4:3 = 1.333)

Perfect fifth 2^(7/12) = 1.4983 (differs slightly from the ideal 3:2 = 1.5)

And Finally: The Tritone (augmented fourth / diminished fifth)

Ratio 2^(6/12) = 1.414. There is no nice ratio, which is why it is so strongly dissonant.

Modern electronic keyboard instruments, fretboards on fretted instruments, etc. are standardised to this 12 tone equal temperament, as it provides "good enough" approximations to the idealised "just ratios" in all musical keys.

Equal temperament is not the only way

Players of instruments that are able to continuously vary their intonation (violinists, singers, etc.) can adjust their pitch to a closer approximation of just intonation.

If you don't insist on your instrument being able to play in all possible keys, you can get a better compromise on certain intervals (especially the thirds) in some keys by tempering eleven of the possible fifths equally to a slightly different value. The last fifth is then different from all the others, is dissonant and is known as a "wolf interval." This type of temperament is known as "meantone."

There are several important meantone tunings. At one extreme Pythagorean tuning has eleven fifths of the just ratio 3:2 (technically not a meantone as the fifths are not tempered at all.) Equal temperament tempers each fifth by 1/12 of a pythagorean comma, so that all twelve fifths are equal. Quarter comma meantone (sometimes referred to simply as "meantone") tempers eleven fifths by 1/4 of a syntonic comma, so that a just major third is achieved.

There are many other possibilities that have been tried throughout musical history, and it's a highly interesting subject for someone who enjoys both math and music.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Dom
    Mar 28, 2021 at 5:07

The tritone is the "Devil in Music" for a reason. If you want equal-tempering, then @musicamante's answer is correct.

However, if you want to think of it in terms of harmonics, then I'd consider treating it as the major 3rd of the fifth of the fifth. So for tonic n, n(3/2)(3/2)(5/4) = 45 / 8. Then multiply by (1/2) until you get into the same octave: 45/8 → 45/16 → 45/32 or 1.40625 which is very close to the square root of two, but not QUITE as obnoxious harmonically, maybe. ;D


1.414 is equal to 707/500. By contrast, an equally tempered augmented fourth is a factor of the square root of two, not of 707/500 nor of any other rational number. But an equally tempered major third is the cube root of two, not 5/4, so it's not clear what you're trying to achieve.

Depending on your purpose, 707/500 may be sufficient, or you may be in big trouble. For example, if you are trying to establish intervals for just intonation, you will run into trouble with this approach, because the augmented fourth in just intonation isn't particularly close to the square root of two. Similarly, the major third of 5/4 is quite far from the cube root of two. If you are using these constants to establish frequencies of synthesized pitches, and if the music you are synthesizing has chords, some of them are likely to be out of tune.

Other answers have done a better job than I probably would of explaining the issue of tuning systems, which your question raises by implying mixed tuning systems. But now you have told us in a comment that you're using these ratios for unmusical purposes. To that, I have two reactions: first, as a programmer, I ask "why would you want to do that?" It seems that it would make your code harder to understand. Second, assuming that you really are set on looking for musical names for various ratios, you will probably find what you need at Wikipedia's List of pitch intervals.

The ratios in that table are for ascending intervals; for the ratio corresponding to the descending interval, take the reciprocal. For example, a descending just major third has the ratio 4:5. Any ratio that is greater than two (or less than 1/2) can be identified using octave equivalence: divide (or multiply) by the appropriate power of two to bring the value between 1 and 2 (or between 1/2 and 1). Then, if the interval name has an ordinal number in it, add to the ordinal the appropriate multiple of seven.

For example, suppose you want a name for the ratio of 32:3. If you divide by 8, you get 4:3, a perfect fourth. Because 8 is 2³, you've reduced the interval by three octaves. To calculate the name of the original interval, therefore, add 7×3 to get 25. The interval associated with the ratio 32:3 is therefore the perfect twenty-fifth.

  • I think this would be the best answer if it provided at least one JI ratio for the tritone, and/or maybe the explanation of how to derive those intervals. This answer brings up the discrepancy between the 1.414 ratio and the just-intonation ratios in the question's premise while explaining why the two aren't compatible, but at the moment it does not appear to provide any concrete solution to the problem under justly-intonated logic.
    – user45266
    Mar 25, 2021 at 0:00
  • @user45266 thanks. I'll edit it a little later to add some more numbers. But the answer doesn't provide a concrete solution to the problem because it's not clear what the problem is. With JI many problems have multiple possible solutions from which one must choose, such as the problem of reconciling four perfect fifths with one major third, but if that isn't relevant to OP's program then there's no point in discussing it.
    – phoog
    Mar 25, 2021 at 0:18
  • 1
    There are much better rational approximations to sqrt(2), with much smaller numerator and denominator, for example 99/70. However, the discrepancy between an equal temperament tritone and 7/5 is roughly the same as the discrepancy between an equal temperament major third and 5/4, so if 5/4 is "good enough" for OP's purposes, then so is 7/5. Mar 25, 2021 at 5:02
  • @DawoodibnKareem if OP it's looking for just intonation then 5/4 is not a "good enough" approximation but precisely the desired value. In that case, it may be that the square root of two is the approximation rather than the thing being approximated, and that the value being sought is in fact 45/32.
    – phoog
    Mar 25, 2021 at 5:25
  • 1
    @chasly-supportsMonica Grossly over-simplifying here, but essentially, pitch is the logarithm of frequency. So multiplying the frequency by some factor corresponds to adding an interval to the pitch. Mar 25, 2021 at 20:26

The ratio for the augmented fourth depends on the particular tuning system (temperament) being used. There are a number of posts on this site that address these and related issues.

  • 6
    I might be misremembering, but I think it's generally good form to briefly describe the contents of a link in answers on SE because links have a nasty habit of breaking. Also, this does kind of read like a comment to my eyes because of the unexplained links.
    – user45266
    Mar 25, 2021 at 0:03
  • 1
    @user45266 All of the links are to other SE posts.
    – Aaron
    Mar 25, 2021 at 0:04

In just intonation, the most natural way to get an augmented fourth is probably to add a major third (5/4) to a major second (either 10/9 or 9/8). This gives us either 25/18 (1.388888...) or 45/32 (exactly 1.40625). Of course, the fraction 7/5 (exactly 1.4) lies in between these, so perhaps it's a better choice.

A diminished fifth would be either 64/45 (1.422222...) or 36/25 (exactly 1.44). Lying in between these is 10/7 (1.428571 repeating).

When I say "add" above, I'm referring to adding pitch intervals, which means multiplying the corresponding frequency ratios, hence why an interval with a frequency ratio of 5/4, plus an interval with a frequency ratio of 9/8, is an interval with a frequency ratio of 45/32.

  • Under what definition of "add" does 5/4 + 9/8 = 45/32 ? - Do you mean "multiply", and why should that give the desired answer? Please can you explain your theory - thanks. Mar 25, 2021 at 19:15
  • @chasly-supportsMonica I've added a paragraph where I try to explain that. What do you think? Mar 25, 2021 at 19:29
  • @chasly-supportsMonica this is the same principle that underlies the slide rule, whereby a logarithmic scale is used to convert multiplication into addition. In this case, because pitch is logarithmic, the addition of semitones (or any other interval) on the pitch scale is equivalent to the multiplication of the corresponding frequency ratios. The simplest example: add one octave to A2, and the result is A3. The frequency calculation is 110 Hz * 2 = 220 Hz. Each time you add an octave, you multiply by 2: A4 is 440 Hz; A5 is 880 Hz; A6 is 1760 Hz.
    – phoog
    Mar 25, 2021 at 20:06

If we're looking for "small" integer ratios, how about 17/12? A perfect 5th is 3/2, or 18/12; a fourth is 4/3, or 16/12. So the nearest small-int ratio between 'em would be 17/12, which is 1.417 versus sqrt(2) at 1.414. That's only 2.5 cents' difference.


You're trying to work backwards from notes to intervals, and that's not the way the system works.

Intervals came before notes. People discovered that specific string length (frequency) ratios objectively produced a unique experience that became known as "consonance". Consonance was interesting, because it was rare. Most string pairs didn't produce this experience, only specific ratios. So people figured out what these ratios were, and built instruments with strings that had these ratios. Cool.

The problem is that you can only use one of the strings as the root that the other strings are "intervals of". You also couldn't play your instrument with other people who were tuned to some other arbitrary frequency. Plus the strings don't form intervals between each other, plus you only have "consonance" and no other dissonant notes. Sounds consonant, but not at all functional.

So people decided to create an equally-tempered scale of notes, where the notes were logarithmically linear. Start with the basic multiplier (an octave) of 2. Then split it into n logarithmically-even steps: 2^(1/n). If you set n to 5, you can multiply x by 2^(1/5) to sequentially produce each note of the 5-tet scale, until you get to the fifth which makes it 2^(5/5)x = 2x (the octave).

You can pick any n to cut the octave into n logarithmically even steps (notes), until you get to the octave. So you can split the octave into 4 notes, 5 notes, 6 notes, whatever.

This seems totally disconnected from intervals though. How are logarithmically even scales related to intervals? What's the point of this?

They aren't related. Intervals are for consonance. Equally tempered scales are to produce instruments that are functional. These are two unrelated ideas, but they have to be mashed together in some manner so you can have functional instruments (equal-tempered) but also don't sound like garbage (need the intervals).

So the solution was to just pick arbitrary (literally just guess) values of n, splitting the octave into n steps, and pray that at least a few of the resulting notes have values that match up with your desired intervals (3:2 for example). You also need to pray that the n needed to get your intervals isn't some huge number like 100, because then you'd have 100 notes in your occtave, only 5-6 of which have your desired intervals.

Turns out that no value of n works. There's no n that gives us our desired intervals. The math doesn't work out, and you can prove it. So you never get your desired intervals through equal temperament. But you can pick some values of n where a few of the notes are kinda-sorta-ish-squint-your-ears a bit close approximations of your desired intervals, and then just group them together into a subset-scale you call the "diatonic scale" (this is your maj/min scale), and then shove the rest of the g̶a̶r̶b̶a̶g̶e̶ "accidental" notes off the staff and to the back of the piano.

Turns out 12 is a decent number. We get a few notes that roughly approximate desired intervals, and not too many unnecessary accidental by-product notes. So people stuck with that.

So about the augmented 4th. It's the 6th note. It was never a desired interval. It's an accidental by-product of the 12-TET system. It wasn't produced by finding nice ratios, it was produced by repeatedly multiplying 2^(1/12) to split the octave into 12 logarithmically-even notes (12-Tone Equal Temperament). So it isn't even guaranteed to be a rational number and have a ratio.

How to find it? Just do the 12-TET multiplication:

2^(1/12)^6 = 2^(6/12) = 2^(1/2) = sqrt(2).

Square root of two is irrational. There is no interval ratio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.