[HN Gopher] The Mathematics of Tuning Systems
       ___________________________________________________________________
        
       The Mathematics of Tuning Systems
        
       Author : u1hcw9nx
       Score  : 79 points
       Date   : 2026-01-31 09:04 UTC (4 days ago)
        
 (HTM) web link (math.ucr.edu)
 (TXT) w3m dump (math.ucr.edu)
        
       | kensai wrote:
       | When you think the article is ending, you get more links for
       | further indulging! Thanks.
        
       | aa-jv wrote:
       | A very nicely written and detailed article, with many details I
       | have not personally learned of, in my own music technology
       | hacking so far .. if anyone else is interested in writing
       | software for musical tuning systems, both Xenharmlib and PyTuning
       | are very extensive libraries for the job .. Xenharmlib for C++
       | and PyTuning for python.
       | 
       | Xenharmlib has deep support for intervals, chords, scales, non-
       | standard notations, and advanced topics like non-Western
       | harmonics, diatonic set theory, and non-octave-repeating systems
       | and also allows for the mathematical manipulation of ratios and
       | structures (harmonic exploration).
       | 
       | PyTuning allows for generating scales from ratios/cents, EDO,
       | just intonation, and custom temperaments and facilitates
       | calculations such as frequency ratios, comma approximations, and
       | temperament comparisons, aligning with the article's derivations
       | and trade-off discussions at a similar depth.
       | 
       | I hope to see more math of music articles in the future .. its a
       | fascinating subject indeed!
        
       | uwagar wrote:
       | As we'll see, seeking the Pythagorean ideal causes trouble. It
       | will unleash the devil in music.
       | 
       | ^^ from the article. this kind of thing bothers me. what is the
       | devil? for whom is it the devil? music doesnt havent to be
       | "christian" to "sound good".
        
         | giraffe_lady wrote:
         | It's not a literal allusion to satan and never was, it's akin
         | to the idiom "the devil is in the details."
         | 
         | It was nearly or actually impossible to harmonize or progress
         | tritones while following the medieval "rules" for church music
         | composition. So it is someone complaining about their work, not
         | a statement about musical morality or whatever.
        
           | uwagar wrote:
           | multiply by 3^m/2^n is a human construction. and it breaks
           | after a bunch of m,n. to expect it "not to break" is well an
           | expectation. nature always has a comma, its not clockwork.
        
       | giraffe_lady wrote:
       | Very cool explanation. Something I've come across a few times on
       | here was wanting to explain how 12tet "includes" or handles
       | approximations of intervals from other scales, and how that
       | affects the musical choices of musicians or especially the
       | notation choices for transcription of improvised music.
       | 
       | But it's impossible to explain without getting into like, what is
       | even the problem solved by tuning systems. Without the intuition
       | that comes from making music, programmers and engineers see the
       | fractions & obvious series and get too fixated on finding the
       | "perfect" system. When these are much more physical tools,
       | created over time to make certain processes easier. Tuning
       | systems are more like a woodworker's knives than like the unit
       | circle: being perfect does not make them better tools for
       | creation if they are already fit enough.
        
         | TheOtherHobbes wrote:
         | 12tet is a _practical_ compromise between overtone
         | approximation and playability.
         | 
         | Any fretted or keyed acoustic instrument with more than 12
         | notes/octave is extremely difficult and expensive to build and
         | hard to tune and play.
         | 
         | The music is also hard to notate, because there are so many
         | more possible pitch positions.
         | 
         | So 12 notes became a practical default for instrument builders.
         | And from there, ET became a practical default for tuning to
         | allow smooth-ish modulation through different keys. The errors
         | in the tuning are the same for every key, so the tuning
         | relationships stay the same while the key root changes.
         | 
         | That doesn't quite happen because overtone perception and
         | beating effects aren't completely linear. But it avoids the
         | obvious out-of-tune notes you get when playing in distant keys
         | with non-ET tunings.
        
           | tzs wrote:
           | An interesting option for fretted instruments is to build it
           | with 12 regular frets per octave, and then add temporary
           | extra frets if you want to make specific notes more in tune
           | for the key you are in.
           | 
           | This was common for lute players in the Renaissance and
           | Baroque periods. Lute frets were usually made of the same
           | material as strings and were tied on around the neck, so
           | adding an extra full width fret was not hard.
           | 
           | Of course being tied on lute frets were also movable, so they
           | could also reposition the regular 12 frets instead of adding
           | extras.
           | 
           | Instead of tying on an extra full width frets another common
           | option was partial frets. They would glue a piece of string
           | or wood under a specific string, to just give an option to
           | play one note with either the regular fret or the more in
           | tone little fret (called a "tastino" (plural is "tastini")).
           | 
           | In this video [1] Brandon Acker uses a guitar that his
           | luthier friend was building that had not yet had the frets
           | installed to demonstrate with lute style tied on frets some
           | different 12 tone tunings, then demonstrates using tastini to
           | improve specific notes, such as little fret on the G string a
           | little before the first regular fret so that G# and A can be
           | different notes.
           | 
           | The tastini he uses in the video are simply pieces of string
           | held on with a piece of tape, so quick and easy to add and
           | remove.
           | 
           | [1] https://www.youtube.com/watch?v=tiKCORN-6m8
        
       | HPsquared wrote:
       | With real instruments, you must also manage inharmonicity.
       | 
       | A real piano string, for instance, is made of metal and resists
       | bending slightly unlike an idealised string. This affects higher
       | harmonics more than lower ones (think of all the bends in the
       | string on the 7th harmonic, for example). This increases the
       | harmonic frequencies slightly above exact integer multiples of
       | the fundamental.
       | 
       | As a result, pianos require "stretched tuning" so the harmonics
       | better match the higher notes. It's always a bit of a compromise.
       | The higher harmonics will be more "off" than the lower ones.
       | 
       | So even if you were to tune the fundamental frequency of all the
       | keys on a piano "perfectly" in a given key (so-called Just
       | Intonation), the harmonics would not perfectly match up.
        
         | jankhg wrote:
         | There is actually an interesting mathematical method for piano
         | tuning that takes harmonics into account [1]. The core idea is
         | to minimize the integral over the logarithm of the sum of all
         | spectra. This basically favors spectra that are smeared out
         | less. Instead of the logarithm, one could also use another
         | sublinear function, such as the square root, but I guess it
         | just makes for a better story to call it ,,piano entropy
         | tuner". The paper also shows a nice plot about the ,,stretched
         | tuning" that you mentioned.
         | 
         | [1] https://arxiv.org/abs/1203.5101
        
       | heikkilevanto wrote:
       | A bit too mathematical for my taste. I learned my tuning theory
       | by owning a harpsichord, and learning to tune it. A harpsichord
       | is more sensitive to the "rounding errors" in equal tuning, owing
       | to the richer overtones, so equal temperament does not sound
       | quite as good a compromise as it does on a piano. And those
       | historical temperaments are so much easier to tune by ear.
       | Besides that is what the they used at the time of Bach, so
       | historically correct for playing Baroque music.
        
       | nayuki wrote:
       | > Some people who never play the piano claim it would be easier
       | if had all white keys, or simply white alternating with black.
       | 
       | Actually, I'm one of those people. For over 20 years, I struggled
       | with playing piano because I would have to memorize a different
       | fingering pattern for the major scale in 12 different keys. I
       | knew the mechanical process of it, but it was hard to develop the
       | muscle memory and play songs by ear based on intuition alone. So
       | I was most comfortable playing in C major (white keys only) and
       | using mechanical/electronic transposition.
       | 
       | In the year 2024, I stumbled upon the Janko piano layout (
       | https://en.wikipedia.org/wiki/Jank%C3%B3_keyboard ), which turns
       | out to be the smallest modification to standard piano that
       | results in an isomorphic keyboard. I kid you not, I was up and
       | running in less than 5 minutes - I just treated the layout as if
       | it was a pattern to learn on standard piano, except that it was
       | the only pattern I ever had to learn. On Janko, I found it much
       | easier to play songs by ear, in any key. I wish I discovered
       | Janko earlier, as standard piano was never a good fit for my
       | brain.
       | 
       | For anyone who is curious to try, here's a software Janko piano
       | keyboard that you can play right in the web browser:
       | https://novayashkola.org/janko/
        
         | simojo wrote:
         | I suppose that's why the harpejji [0] has recently gained
         | popularity? I too have wished for an isomorphic keyboard. All
         | of the non-stacked ones become either too wide or the keys
         | become too skinny. Example: Dodeka Keyboard [1]. I know that
         | the Lumatone [2] exists too, but it is too progressive for my
         | taste :)
         | 
         | As a side note, the traditional keyboard size is not
         | representative of the average pianist's hand size. David
         | Steinbuhler [3] has been making modified traditional keyboard
         | layouts by varying the width of the keys slightly, and people
         | rave about it. I've had the chance to visit his shop in
         | Titusville, Pennsylvania, where he designs them. It's a totally
         | enhanced playing experience, even for someone like me who can
         | play a 10th without difficulty.
         | 
         | [0] https://en.wikipedia.org/wiki/Harpejji [1]
         | https://dodekamusic.com/ [2] https://www.lumatone.io/ [3]
         | http://dsstandardfoundation.org/the-standards/
        
       | mbo wrote:
       | If anyone wants to hear the practical effects of a 1/4 comma
       | meantone temperament compared to an equal temperament, Brandon
       | Acker gives a wonderful overview on the classical guitar:
       | https://www.youtube.com/watch?v=tiKCORN-6m8
        
       ___________________________________________________________________
       (page generated 2026-02-04 23:01 UTC)