First let’s talk about pitch. Just so we’re clear: when we talk about the pitch of a note, we’re actually referring to how many times per second that note is vibrating.
Press any piano key and the corresponding string inside the piano vibrates, pushing air molecules around in whatever room you’re seated in. Thanks to specialized nerves inside your ear and brain, you experience this vibration of air as a sensation that we call “hearing”.
On a piano, the lowest-frequency note is the key furthest to the left and the highest-frequency note is furthest right. Each string inside the piano is measured to a precise length and then stretched to exactly the right tightness so that it will produce the desired pitch.


at left: a low pitch, made visible by science!
at right: high frequency.
The same’s true of stringed instruments like the guitar. When a guitarist presses a string to the fretboard, she’s basically pinching off the string to make it shorter (and thus higher pitched). Each fret on the guitar’s fretboard will shorten the string to a specific length, so each fret produces a distinct note.
Makers of musical instruments go to a lot of trouble to ensure that all this complicated math is taken care of long before the instrument ever reaches your waiting arms.
The strings on an instrument tend to slip, slacken, or tighten slightly over time. As this happens, notes begin to sound a bit sour depending on how far they wander from their intended pitch. This explains why pianos and guitars need to be tuned (and why digital keyboards don’t).
Guitars, pianos, your voice, and other instruments share this in common: they can all play the notes of the musical alphabet.