Why can't you tune your guitar? (2019)

2026-03-0422:30245181www.ethanhein.com

Short answer: because math. Longer answer: because prime numbers don’t divide into each other evenly. To understand what follows, you need to know some facts about the physics of vibrating st…

Short answer: because math. Longer answer: because prime numbers don’t divide into each other evenly.

To understand what follows, you need to know some facts about the physics of vibrating strings:

  • When you pluck a guitar string, it vibrates to and fro. You can tell how fast the string is vibrating by listening to the pitch it produces.
  • Shorter and higher-tension strings vibrate faster and make higher pitches. Longer and lower-tension strings vibrate slower and make lower pitches.
  • The scientific term for the rate of the string’s vibration is its frequency. You measure frequency in hertz (Hz), a unit that just means “vibrations per second.” The standard tuning pitch, 440 Hz, is the pitch you hear when an object (like a tuning fork or guitar string) vibrates to and fro 440 times per second.
  • Strings can vibrate in many different ways at once. In addition to the entire length of the string bending back and forth, the string can also vibrate in halves, in thirds, in quarters, and so on. These vibrations of string subsections are called harmonics (or overtones, or partials, they all mean the same thing.)

If you watch slow-motion video of a guitar string vibrating, you’ll see a complex, evolving blend of squiggles. These squiggles are the mathematical sum of all of the string’s different harmonics. The weird and interesting thing about harmonics is that each one produces a different pitch. So when you play a note, you’re actually hearing many different pitches at once.

It’s not difficult to isolate the harmonics of a vibrating string and hear their individual pitches. Harmonics are very useful for tuning your guitar – here’s a handy guide for doing so. They are also the basis of the whole Western tuning system generally.

The math of harmonics is really simple

As a string vibrates, its longer subsections produce lower and louder harmonics, while its shorter subsections produce higher and quieter harmonics. Click the image below to hear the first six harmonics of a string:

Remember that in a real-world string, you are hearing all these harmonics blended together. However, you can isolate the harmonics of a guitar string by lightly touching it in certain places to deaden some of the vibrations.

  • If you touch the vibrating string at its halfway point, that deadens the vibration along the string’s entire length, enabling you to hear it vibrating in halves.
  • If you touch the string a third of the way along its length, that deadens the vibration both of the entire string and the halves of the string, so you can now hear it vibrating in thirds.
  • If you touch the string a quarter of the way along its length, that deadens the vibration of the whole string, the halves, and the thirds, so you can now hear it vibrating in quarters.

Harmonics give you a good-sounding collection of pitches

Imagine that you have a guitar string tuned to play a note called “middle C,” which has a frequency of 1 Hz. (In reality, middle C has a frequency of 261.626 Hz, so if you want to think in terms of actual frequencies, just multiply all the numbers in the following paragraphs by 261.626.)

The first harmonic is the string vibrating along its entire length, otherwise known as the fundamental frequency. When we say that your C string is vibrating at 1 Hz, that really means that its fundamental has a frequency of 1 Hz. The other harmonics all have other frequencies, and we’ll get to those, but the fundamental is usually the loudest harmonic, and it’s usually the only one you’re aware of hearing.

The second harmonic is the one you get from the string vibrating in halves. Each half of the string vibrates at twice the frequency of the whole string. The 2:1 relationship between the pitches of the first and second harmonics is called an octave. (I know that the word suggests the number eight, not the number two. Don’t worry about it.) The pitch that’s an octave above middle C has a frequency of 2 Hz, and it is also called C. Both of these notes have the same letter name because in Western convention, notes an octave apart from each other are considered to be “the same note“. The important concept here is that you can move up an octave from any pitch by doubling its frequency. You can also move down an octave from any pitch by halving its frequency.

The third harmonic is the one you get from the string vibrating in thirds. Its frequency is three times the fundamental frequency. Since your C string’s fundamental is 1 Hz, the third harmonic has a frequency of 3 Hz, and it produces a note called G. The interval between C and G is called a perfect fifth, for reasons having nothing to do with harmonics. I know it’s confusing.

The fourth harmonic is the one you get from the string vibrating in quarters, at 4 Hz. This note is an octave higher than the second harmonic, and so is also called C. (The eighth harmonic will also play C, as will the sixteenth, and the thirty-second, and all the powers of two up to infinity.)

The fifth harmonic is the one you get from the string vibrating in fifths. Its frequency is 5 Hz, and it produces a note called E. The interval between C and E is called a major third, which is another name that has nothing to do with harmonics.

There are many more harmonics (infinitely many more, in theory) but these first five are the most audible ones.

The ancient Greeks figured out that if you have a set of strings, it sounds really good if you tune them following the pitch ratios from the natural harmonic series. In such tuning systems, you pick a starting frequency, and then multiply or divide it by ratios of whole numbers to generate more frequencies, the same way you figure out the frequencies of a single string’s harmonics. The best-sounding note combinations (to Western people) are the ones derived from the first few harmonics. In other words, you get the nicest harmony (for Western people) when you multiply and divide your frequencies by ratios of the smallest prime numbers: 2, 3, and 5.

So, let’s do it. Let’s make a tuning system based on the harmonics of your C string. First, we should find the C, G and E notes whose frequencies are as close to each other as possible.

  • We’ve already got C at 1 Hz.
  • We can bring our G at 3 Hz down an octave by dividing its frequency in half. This gives us a G at 3/2 Hz.
  • We can also bring our E at 5 Hz down two octaves by dividing its frequency in half twice. This gives us an E at 5/4 Hz.

When you play 1 Hz, 5/4 Hz and 3/2 Hz at the same time, you get a lovely sound called a C major triad.

So far, so good. Let’s find some more notes!

We can extend our tuning system by thinking of G as our base note, and looking at its harmonics. When we do, we get two new notes. The third harmonic of G is D at 9 Hz. (Thanks to octave equivalency, we can also make Ds at 9/2 Hz, and 9/4 Hz, and 9/8 Hz, and 18 Hz, and 36 Hz, and so on.) The fifth harmonic of G is B at 15 Hz. (There are also Bs at 15/2 Hz, and 30 Hz, and so on.)

The notes C and G feel closely related to each other because of their shared harmonic relationship. The chords you get from their respective overtone series also feel related. If you alternate between C major and G major chords, it just about always sounds good.

Now let’s extend our tuning system further by treating D as our base note. The harmonics of D give us two more new notes: the third harmonic is A at 27 Hz (and 27/2 Hz and 27/4 Hz and 27/8 Hz), and the fifth harmonic is F-sharp at 45 Hz (and 45/2 Hz and 45/4 Hz and 45/8 Hz).

G major chords and D major chords have the same relationship as C major and G major chords, and they sound equally good when you alternate them. Also, C major, G major and D major chords all sound good as a group, in any order and any combination. Western people just really like the sound of shared harmonics. Last thing: notice that you can combine the harmonics of C, G and D to form a G major scale.

Now let’s make some more notes by treating A as our base and looking at its harmonics. The third harmonic of A is E at 81 Hz (and 81/2 Hz and 81/4 Hz etc).

But wait. We already had an E, at 5 Hz. If we put these two E’s in the same octave, then one of them is at 80/64 Hz, and the other is at 81/64 Hz. That may not seem like much of a difference, but even untrained listeners will be able to hear that they are out of tune with each other. Furthermore, if we use the E derived from C, then it will be out of tune with A. However, if we use the E derived from A, then it will be out of tune with C. This is going to be a problem.

Let’s forget about that conflict for a second. Instead, we’ll try a different method of expanding our tuning system, by going in the opposite direction from C. Let’s think about a note that contains C in its harmonic series. That would be F at 1/3 Hz. The third harmonic of F is C at 1 Hz, as expected. The fifth harmonic of F is A at 5/3 Hz.

Uh oh. This new A conflicts with the one we already had at 27 Hz. That is not good. But let’s bracket that and keep expanding.

We can push further left by finding the note whose overtone series contains F. That would be B-flat at 1/9 Hz. Its third harmonic is F at 1/3 Hz, and its fifth harmonic is D at 5/9 Hz. And now we have a new problem: this D clashes with our existing D at 9 Hz.

Can you see the pattern here? Anytime you want to use intervals based on third harmonics, you’re multiplying and dividing by 3, but anytime you want to use intervals based on fifth harmonics, you’re multiplying and dividing by 5. (Notice that the conflicting notes always conflict by the same amount, too, a ratio of 81/80.) Starting from C, it’s possible to produce any note if you multiply or divide your frequencies by 3 enough times, but those notes won’t be in tune with the notes you’d get multiplying or dividing your frequencies by 5, because 3 and 5 don’t mutually divide evenly. This is not just an abstract mathematical issue. It’s the reason that it’s impossible to have a guitar be in tune with itself.

Guitars can’t be perfectly in tune

Imagine that the guitar’s low E string has a frequency of 1 Hz. (It’s really 82.4069 Hz; feel free to multiply everything in this next section by that number if you want actual frequencies.) Ideally, you want your high E string to be tuned two octaves above the low one, at 4 Hz. Let’s see if you can get there by tuning the strings pairwise.

  • The interval between E and A is a fifth, but it’s upside down, because we’re going down a fifth from E. In music theory terms, an upside down fifth is called a fourth. You go up a fourth by multiplying your frequency by 4/3 (it’s 3/2 upside down, doubled to bring it up an octave.) So your A string is now tuned to 4/3 Hz.
  • The D string should be another fourth higher, so you can multiply by 4/3 again, giving you 16/9 Hz.
  • The G string should be yet another fourth higher, so you multiply by 4/3 to get 64/27 Hz.
  • The B string is a major third higher than G, which means multiplying by 5/4, and that puts you at 80/27 Hz.
  • Finally, to get to high E, that’s another fourth, so you multiply by 4/3 again, giving you… uh… 320/81 Hz.

This is not good. We wanted the high E to be at 4 Hz, which is the same as 324/81 Hz. We’re 4/81 Hz flat! That difference is big enough to make your guitar tuning sound like warm garbage.

Let’s try a different strategy. I said you should tune the B string a major third above G. However, you could just as easily retune the B string so it’s a fifth plus an octave above the low E string. You do this by multiplying 1 Hz by 3/2, and then doubling it, which puts your B at 3 Hz. Now the B string sounds perfectly in tune with the low E string at 1 Hz, and with the high E string at 4 Hz. Unfortunately, the B string is now out of tune with the G string at 64/27 Hz.

So maybe you should just retune the G string a major third below your new B, at 12/5 Hz. That makes the G and B strings sound great together. Unfortunately, now the G string is out of tune with the D string at 16/9 Hz.

You could retune the D string to be a fourth below G… but now the D string will be out of tune with the A string. If you retune the A string based on your new D, then it will be out of tune against the low E string. And if you retune the low E string based on your new A, then it will be out of tune with the high E string.

The bottom line: there is no way to tune the guitar so that every string is in tune with every other string. 

The standard tuning system is an unsatisfying compromise

The mathematical awkwardness of harmonics-based tuning systems has caused Western musicians a lot of pain over the past thousand years. Depending on your starting pitch, some intervals can be perfectly in tune, but others can’t be. And the more harmonically complex you want your music to be, the worse the tuning issues become.

In the 16th century, Chinese and Dutch musicians independently came up with an alternative system to harmonics-based tuning, called 12-tone equal temperament, or 12-TET. It’s the system that the entire Western world uses today. The idea behind 12-TET is to have everything be pretty much in tune, which you accomplish by having everything be a little bit out of tune. Is this a worthwhile compromise? Let’s do the math and find out.

In 12-TET, you divide up the octave into twelve equally-sized semitones (the interval between two adjacent piano keys or guitar frets). To go up a semitone from any note, you multiply its frequency by the 12th root of 2 (about 1.05946). To go down a semitone from any note, you divide its frequency by the 12th root of 2. If you go up by an octave (twelve semitones), you’re multiplying your frequency by the 12th root of 2 twelve times, which works out to 2. That’s a perfect octave, hooray! Unfortunately, you can’t exactly create the other harmonics-based intervals by adding up 12-TET semitones; you can only approximate them.

Remember that the pure fifth you get from harmonics is a frequency ratio of 3/2. In 12-TET, however, you make a fifth by adding up seven semitones. This means that you multiply your frequency by the 12th root of two seven times, which comes to about 1.498. That’s close to 3/2, but it’s not exact. As a result, fifths in 12-TET sound a little flat compared to what your ear is expecting from natural harmonics.

Major thirds are worse in 12-TET. Recall that the major third you get from the overtone series is a frequency ratio of 5/4. In 12-TET, you make a major third by adding four semitones, which means that you multiply your frequency by the 12th root of 2 four times. That comes to 1.25992, which is noticeably higher than 5/4. Thirds in 12-TET are quite sharp compared to what your ears are expecting from natural harmonics.

If thirds and fifths are so out of tune in 12-TET, why do we use it? The advantage is that all the thirds and fifths in all the keys are out of tune by the same amount. None of them sound perfect, but none of them sound terrible, either. You don’t have to worry about whether your notes are derived from the third harmonic of some note or the fifth harmonic of some other note; they all just work together, kind of. If you use a digital guitar tuner, you are tuning your strings to the 12-TET versions of E, A, D, G and B. None of them will be perfectly in tune with each other, but they will all be wrong by an acceptable amount. Also, songs in the key of E won’t sound any better or worse than songs in the key of F or E-flat.

Not everyone in history thought that 12-TET was an acceptable compromise. Johann Sebastian Bach thought we should use other tuning systems that made better-sounding thirds and fifths in some keys in exchange for worse-sounding thirds and fifths in others. In Bach’s preferred tuning, each key had its own distinctive blend of smoothness and harshness. However, Bach did not get his way. We as a civilization have collectively decided that we want all our keys to be interchangeable. There are good reasons to want this! In 12-TET, all intervals and chords are built from standardized, Lego-like parts. You don’t have to keep track of a complicated web of different-sized intervals in every key. If you move a song from C to C-sharp or D or anywhere else, you can be confident that it will still sound “the same.”

You don’t have to use 12-TET, though

Some musicians don’t want to accommodate to 12-TET, insisting instead that we should continue to use pure intervals derived from harmonics the way God and Pythagoras intended. Harmonics-based tuning systems are collectively known as just intonation systems. This is a poetically apt term, because it implies fairness. By contrast, the implicit message of 12-TET is that life isn’t fair. Just intonation systems give you some lovely pure intervals, but you can’t change keys unless you retune all your instruments. In other world cultures, this is not necessarily a problem. Hindustani classical music uses just intonation over an omnipresent drone, so everything is always in the same “key.”

Meanwhile, a few Western oddballs and nerds have explored just intonation systems that use bigger prime numbers than 2, 3 and 5 to generate finer pure intervals. Harry Partch used the primes up to eleven to make a tuning system that divides up the octave into 43 pure parts rather than 12 impure ones. You can try the Partch 43-tone scale using the Wilsonic app or Audiokit Synth One. It’s extremely strange! But, I guess, it’s strange in a pure way. I have made some music of my own with exotic just intonation tunings.

Just intonation may also play a role in the blues. There is a theory that the blues originates from the natural overtone series of I and IV. If this is true, then the characteristic chords and scales of the blues are really 12-TET approximations of the original just intonation blues scale. It’s conventional to say that blues musicians and singers bend notes to make them go out of tune, but it may be that they are actually bending the 12-TET pitches to get them in tune instead.

Anyway, outside of the blues and the avant-garde, most Western musicians just live with everything being a little out of tune. If you’re a guitarist, you know that no matter how you tune your guitar, it won’t stay in tune for long anyway, so how much does any of this even matter? There’s a joke among guitarists: we spend half our lives tuning, and the other half wishing we were in tune. There are lots of reasons why tuning is hard: you might be hampered by having a poorly made guitar, or by having a guitar that’s not set up correctly, or by using old worn-out strings, or by changes in temperature or humidity, or just by a lack of patience or time. At least you can be secure in the knowledge that some of your tuning struggles are due to the basic unfairness of the universe, and not just the limitations of your ears or your equipment.


Read the original article

Comments

  • By post-it 2026-03-0815:438 reply

    > If you watch slow-motion video of a guitar string vibrating, you’ll see a complex, evolving blend of squiggles. These squiggles are the mathematical sum of all of the string’s different harmonics.

    This is incorrect. If you watch a video like [0], the squiggles aren't real, they're an artifact of a rolling shutter camera. A real slowmo camera will correctly show the entire string vibrating[1].

    The rest of the article is correct, but you can't see harmonics happening to the string.

    [0] https://youtu.be/XOCGb5ZGEV8 [1] https://youtu.be/6sgI7S_G-XI

    • By dahart 2026-03-0816:592 reply

      Hold on. Your first video is indeed a rolling shutter artifact. But your second video never shows enough of the string to see the harmonics. When you (for example) pluck with a finger on the 12th fret, you absolutely do have a real physical squiggle vibrating in the string, with one node and two antinodes. With a 7th fret harmonic, there are 3 antinodes, with a 5th fret harmonic there are four. There are squiggles, and you can see them with real slowmo.

      • By sdeframond 2026-03-0913:03

        You can actually see the node with the naked eye. No need for slow mo: the stays put while the rest of the string looks like a blurry mess.

      • By engine_y 2026-03-0820:11

        Yes, I think that with all these videos what you actually see is aliasing...

    • By alephnil 2026-03-099:37

      You would need a frame rate higher than the Nyquist frequency of highest harmonic you want to capture. Since the fundamental frequency of the lowest pitch sting is 83.4 Hz, and you want to capture up to the fifth harmonic (at 83.4 Hz * 5 = 417 Hz) and double that to get the Nyquist frequence, so at least 834 fps. So you would need a high speed camera with 1000 fps to capture the real vibrations.

    • By RealityVoid 2026-03-0816:04

      While you're of course righ, in a certain way, the squiggles _are_ a function of the frequnencies that the chords are vibrating at. What you see is the interaction of the two frequencies, your the interaction depends on both frequencies.

    • By actsasbuffoon 2026-03-0819:08

      Not sure if I’m misunderstanding your claim. A string does vibrate as the sum of the string’s harmonics. That’s how pinch harmonics work, and they wouldn’t work if that wasn’t the case.

      You poke a spot where a given harmonic doesn’t vibrate, and that takes energy away from the other harmonics that do need to vibrate at that spot.

      If we’re just talking about visually being able to see them, I suppose that’s a different question. Maybe on an incredibly low pitched string, or with a strobe light playing at a synced frequency? But in terms of what the string is doing, it is vibrating as the sum of its harmonics.

    • By phkahler 2026-03-0820:421 reply

      >> but you can't see harmonics happening to the string.

      But you absolutely can if you rest a finger on a node and pick it, producing primarily the harmonic. You can even see the lesser vibration at the nodes with your eyes.

      • By kazinator 2026-03-090:141 reply

        If you stretch a rope or chain several meters long, you can simultaneously see the fundamental and first harmonic standing wave.

        • By geon 2026-03-0914:271 reply

          It is fun to kick a guywire and watch the single pulse travel along the wire, be reflected and come back.

          • By DANmode 2026-03-0916:25

            > It is fun to kick a guywire

            Way braver than me!

    • By fuzzfactor 2026-03-0816:51

      Interestingly, with an oscilloscope you can see the harmonics in all their gory detail :)

      Actually depending on microphone or instrument interface, you can see stuff that's beyond the range of hearing too.

      Also, on a low-frequency long-string like an upright bass, if it is bowed at the halfway node, you still hear mainly the fundamental but the second harmonic is naturally emphasized more than usual, and you can also see half the string making its contribution as pictured, with the naked eye.

    • By jMyles 2026-03-0821:062 reply

      > If you watch a video like [0], the squiggles aren't real, they're an artifact of a rolling shutter camera.

      ...is this correct? You can say this about any oscillating phenomenon - that doesn't mean it's not 'real'. The "squiggles" are an artifact of the frequency of the string and the scan rate of the rolling shutter. You'll also see artifacting from a global shutter camera, where the "squiggles" will be an artifact of the string frequency and the frame (rather than scan) rate.

      Or do I misunderstand?

      I've been playing guitar for 25 years, and it seems to me that I can look at the "squiggles" from a rolling shutter capture of a string and tell you which string it is (and possibly, if I'm having a particularly sharp day, whether it's E or drop-D). I've never tested myself this way - am I certain to fail? :-)

      • By tshaddox 2026-03-095:10

        Every pixel of every frame was really captured by the camera from the source, but it’s being played back to you very differently than how the source actually looked.

        The most obvious example of this would be the wagon-wheel effect, where a spoked wheel can appear to rotate at a different speed and direction than its true rotation when captured by a camera under certain conditions.

      • By ses1984 2026-03-0822:441 reply

        How could you tell the note by looking at a string? Unless you’re talking by about marking timestamps and measuring the time between peaks. A 42 gauge string tuned to E or D or any other note are going to look basically the same.

        • By markrages 2026-03-0822:50

          GP is talking about seeing the string oscillations alias against the 30 Hz camera frame rate.

          I've never tried it.

    • By throwaway27448 2026-03-0816:12

      > the squiggles aren't real, they're an artifact of a rolling shutter camera. A real slowmo camera will correctly show the entire string vibrating

      How do you distinguish vibration from squiggles? To me these seem like the same concept, at the very least over time. The moment simply doesn't matter except to neurotic people without a solid understanding of harmonics and especially of sound.

  • By xcf_seetan 2026-03-0815:242 reply

    Actually is not a guitar problem, but all 12-TET tuned instruments have this, it is just a side effect of harmonic math. In the guitar case it is not only the tuning that counts, also the material the string are made and the diameter of the strings count to the final frequency, and we are using parallel frets so applying the same distance to different strings. There are guitars with not parallel frets that try to compensate for the diameter variation. But that’s all math and understanding, cause when you tune your guitar and just play you are in another world were "thought is the killer of flow"; so just play and enjoy the sound. :D

    • By ses1984 2026-03-0816:041 reply

      There are two type of “not parallel” frets and neither have anything to do with the diameter of the strings.

      Different guitarists use different diameter strings because the diameter determines the tension when you tune to pitch. Different people prefer different tension. Most shredders prefer light tension. Most jazz players prefer high tension.

      The diameter is compensated at the bridge and in some guitars the nut. When you press a thin string to a fret, the center of the string is closer to the fret than when a thick string is pushed to the fret. Thicker strings compensate for this by using slightly longer length which you can adjust at the bridge.

      One type of non parallel frets are called true temperament frets. They are sort of parallel but squiggly. This results in better intonation closer to that of a piano.

      Another type of non parallel frets is multi scale or fanned frets. This allows the bass strings to have a longer scale length, which allows you to use relatively thinner strings for bass notes. This is important because when strings get thicker relative to their length, they start to behave more like cylinders with thickness rather than ideal springs, and sound rather nasty because harmonic overtones are out of tune with the fundamental.

      • By fuzzfactor 2026-03-0817:40

        Yes, the diameter is compensated at the same time as the tension.

        When the string's action is higher above the frets, the tension increases more when fretted than open, to a greater degree than low action.

        So the saddle for that string needs to be positioned such that the plucked portion of the string is slightly longer than it would need to be if the tension were the same as the open string.

    • By _alternator_ 2026-03-0816:021 reply

      Another thing that’s not been mentioned here: there is a relationship between volume and pitch. In short, you strike a string hard and it goes a bit sharp. The issue is that the tonal math makes a linearization of the string physics, but the highly activated string is effectively a little tighter than the idealized version.

      • By tadfisher 2026-03-0818:551 reply

        Humans are also not perfect at fretting with the exact same pressure every time, or without inducing some bend in the strings. This is really noticeable with the G string which always sounds out of tune while playing, because our tuning system gives it a half-step-down intonation as a trade-off to make it easier to form chords.

        James Taylor compensates by tuning everything down a few cents, between -12 at the low E and -3 at the high E, with a little break in the pattern with -4 cents at the G to deal with its weirdness. Good electronic tuners have "sweetened" presets which do something similar.

        • By allears 2026-03-092:32

          Peterson guitar tuners can do custom tunings, and have the James Taylor tuning built in as a preset. (On Peterson tuners, it's called the 'acoustic' preset, but is actually the JT tuning.)

  • By JohnMakin 2026-03-0816:003 reply

    I was born with something not quite like perfect pitch, but when something is even slightly off tune it caused physical discomfort for me.

    My cs department had a cool project class where you built what was basically a raspberry pi with a microcontroller by hand, and you had to use the dumb speaker and controller to make your own music firmware to produce notes. the challenge involved, was basically, the processor’s clock wasnt fine grained enough to produce perfect notes. I wanted to make a simon says toy but the notes were off. I approached my professor with my problem and he said I could cheat the processor clock in a clever way to get what i wanted and it was such a “oh wow computers are magic” to me, i got the notes i wanted. disappointingly the TA grader wasnt that impressed but that proff ended up offering me a job before I graduated.

    • By PaulDavisThe1st 2026-03-0818:281 reply

      > I was born with something not quite like perfect pitch, but when something is even slightly off tune it caused physical discomfort for me.

      Define off tune? 12 TET? Just intonation? Bohlen-Pierce (56 TET) ?

      The "in tune" notes are as much a function of culture as physics.

      • By otabdeveloper4 2026-03-0910:122 reply

        > The "in tune" notes are as much a function of culture as physics.

        Huh? Pitch ratios are not a social construct, it's just arithmetic.

        • By khafra 2026-03-0911:53

          There's definitely some physical underpinnings--most music systems have the concept of an octave which maps nicely onto frequency-doubling, for example. But there's also culture: For a purely Western example, even-tempering is in tune, but you'll hear different "beat patterns" for a given interval than with an instrument tuned for music in just one key.

        • By reverius42 2026-03-0911:161 reply

          And the choice of which ratios "sound good" is cultural, to some extent.

          • By otabdeveloper4 2026-03-0916:241 reply

            No it isn't. You can hear integer pitch ratios in the same way you can see, e.g., the difference between a square and a rectangle or between a circle and an oval.

            • By PaulDavisThe1st 2026-03-0918:211 reply

              But more than 90% of all the written-composed music from western Europe and North America (at minimum) over the last several centuries does not use integer pitch ratios.

    • By RealityVoid 2026-03-0816:091 reply

      Do say more! What was the problem with the clock, more exactly? I believe you, I've had issues caused by clock skew and CAN bus for example, when you have a small error that is amplified on beach bit enough time, errors add up and you eventually get out of synch.

      But in the case if sound, I would have expected the skew to be less of a problem. Also surprised how the orof instantly know. It took me a while to figure out. How did you fix it? Cool story!

      • By analog31 2026-03-0816:241 reply

        One simplistic way is to successively add a small constant to a large integer, and generate the waveform from the most significant bits. A "cent," which is 1/100 of a semitone, is a factor of about 580 parts per million, so you can work out the precision needed for the constant. On a microcontroller, you can control the timing with a PWM, which runs independently of the processor and its timing foibles.

        Proof is left as an exercise to the student. ;-)

        • By RealityVoid 2026-03-0819:521 reply

          > On a microcontroller, you can control the timing with a PWM, which runs independently of the processor and its timing foibles.

          That is not really true. You usually have a couple of clock sources on a MCU, but the clock gets propagated down the clock tree and the source, and most of the times, the PWM has the same source clock as the CPU. Indeed, I think if you're before the PLL the clock is more accurate as in you get less jitter but the overall drift is the same. You might have distinct clock sources but you need a specific hw and a specific configuration.

          • By analog31 2026-03-0820:34

            Is it enough to have an audible effect? We’re not talking cesium clock levels of stability here. Now my curiosity is piqued, I have to figure out a way to measure this.

    • By PaulDavisThe1st 2026-03-0818:312 reply

      I've been doing audio software for 25-30 years. I have no idea what sort of synthesis you'd be doing where the processor clock played any roll at all. Waveform synthesis is normally done in buffers (8 to 8192 samples), and the "clocking" to convert the sample stream into an analog waveform is done by the audio interface/DAC, not the CPU. If you were basically implementing a DAC, then yes, the clock would matter a lot ... is/was that the issue?

      • By kazinator 2026-03-090:241 reply

        You've not done it long enough to have worked with machine language programs that used instruction timing to click a speaker.

        This worked well in 1980's microcomputers which used an accurate, crystal oscillator clock. IC's like the MOS6502 or Intel 8086 don't have built-in clocking. The boards were large and costly enough to afford a clock; and often it was dual purposed. E.g. in Apple II machines, the master oscillator clock from which the NTSC colorburst clock was derived also supplied the CPU clock.

        These processors had no caches, so instructions executed with predictable timing. Every data access or instruction fetch was a real cycle on the bus, taking the same time every time.

        Code that arranged not to be interrupted could generate precise signals.

        Some microcomputers used software loops to drive serial lines, lacking a UART chip for that. You could do that well enough to communicate up to around 1200 baud.

      • By NobodyNada 2026-03-0819:091 reply

        > you built what was basically a raspberry pi with a microcontroller by hand, and you had to use the dumb speaker and controller to make your own music firmware to produce notes

        This sounds like they were most likely bit banging square waves into a speaker directly via a GPIO on a microcontroller (or maybe using a PWM output if they were fancy about it). In that case, the audio frequency will be derived directly from the microcontroller's clock speed, and the tolerance of an internal oscillator on a microcontroller can be as bad as 10%.

HackerNews