This may puzzle keyboard players and other western musicians, but, when sounded in just intonation—which is possible when singing or playing on a fretless stringed instrument such as the violin—the enharmonic equivalents actually do differ slightly in pitch. For example, consider G sharp and A flat. Call middle C's frequency "X". Then high C has a frequency of 2X. Perfect major thirds need to have frequency ratios of exactly 4 to 5.
In order to form a perfect major third with the C above it, A flat and high C need to be in the ratio 4 to 5, so A flat needs to have the frequency 2X / (5/4) = 1.6 X.
In order to form a perfect major third above E, however, G sharp needs to form the ratio 5 to 4 with E, which, in turn, needs to form the ratio 5 to 4 with C. Thus the frequency of G sharp is (5/4) * (5/4) * X = (25/16) * X = 1.5625 X.
Thus, G sharp and A flat are not the same note; G sharp is, in fact 41 "cents" lower in pitch (41% of a semitone, not quite a quarter of a tone). On a piano, both would be played by striking the same key, with a frequency 28/12X = 1.5874 X. Such small differences in pitch can escape notice when presented as melodic intervals. However, when they sounded as chords, the difference between just intonation and equal-tempered intonation is quite noticeable, even to untrained ears.
The question inevitably arrises why, if almost all western music uses enharmonic equivalence, where Ab is exactly the same pitch as G#, why do we have different names for the same thing? First, there is one way of labelling pitches with one and only one name, sometimes called integer notation, often used in serialism, twelve tone music, and other atonal music. However, in tonal music notes are most often named for their harmonic function. Thus in F minor it is Ab (F minor chord:FAbC), while in E major it is G# (E Major chord:EG#B).
An enharmonic is also one of the three Greek genera in music, in which the tetrachords are divided (descending) as a ditone plus two microtones. The ditone can be anywhere from 16/13 to 9/7 (3.55 to 4.35 semitones) and the microtones can be anything smaller than 1 semitone. Some examples of enharmonic genera are 1. 1/1 36/35 16/15 4/3 2. 1/1 28/27 16/15 4/3 3. 1/1 64/63 28/27 4/3 4. 1/1 49/48 28/27 4/3 5. 1/1 25/24 13/12 4/3