Music and Math in Harmony

by Paul VanRaden

© 2002


return to cover page

     People can enjoy beautiful music and soothing harmonies without understanding math. Even songbirds, whales, and other animals make forms of music without formal training in math. Harmony sounds better when the tones that blend together follow some simple rules even if the artists are not aware of the math. People can listen and practice and try for many years to create better music, or they can learn the math and make better melodies and harmonies today.

    The human voice and some musical instruments can produce a continuous range of frequencies between lower and upper limits. Other instruments require a tuning system to choose a finite number of tones. Humans can sing using many tones or in monotone, and they can paint colorful pictures or draw in black and white. When choosing music, beauty is in the ear of the beholder.


Hearing and Harmony

    Ears sense sounds of different wave length in much the same way that eyes sense lights of different wave length. Sounds move from vibrating surfaces to your ears on air pressure waves traveling at 300 meters per second (700 miles per hour), whereas light moves from vibrating molecules to your eyes on electromagnetic waves traveling at 3 million meters per second (7 million miles per hour). If the source vibrates slower or faster, the time and distance between waves will increase or decrease, resulting in different tones of sound or colors of light. The sounds of music range from the low tones of tubas and cellos to the high tones of flutes and violins. The colors of a rainbow range from low frequency red and orange light to high frequency blue and violet light.

    Harmony results when two or more tones with simple frequency ratios are mixed. Some ears are tone-deaf and some eyes are color-blind, but most ears are able to hear several tones at the same time and most eyes can see several colors at the same time. When two tones with a simple frequency ratio are played together, the result may sound better than either tone played separately. Two colors with a simple frequency ratio also may blend into another pleasing color (such as blue and yellow combining to form green). Other pairs of colors may look bad when mixed, and too many bright colors mix into brown or black. Similarly, certain pairs of tones can clash, and too many or a poor choice of tones can mix into noise instead of a chorus or a symphony.

    Better songs and pictures result when the artist mixes tones of sound or colors of light that match. Artists can use their ears and eyes and trial and error to find matching tones and colors, or they can use math.


Tones and Tuning

    A tone is a series of repeating air pressure waves of uniform size and frequency. Most music is based on a reference tone with standard frequency such as "middle C" with 264 waves per second or the "A" above it with 440 waves per second. A reference tone allows standard tuning of instruments and lets all other tones be set in proportion to the standard tone, which can be assigned a relative frequency of 1 to keep the math simple. The relative frequency of any other tone is its frequency divided by the standard. For example, a series of "C" tones with 132, 264, 528, and 1056 waves per second may be assigned relative frequencies of .5, 1, 2, and 4, respectively.

    Two tones with relative frequency 1 and 2 are called doubles (formerly octaves). They always sound good when heard together because the two tones blend into a repeating wave pattern that is easy for ears to hear: large wave, small wave, large wave, small wave. Large and small increases in pressure continue to alternate with every other wave as long as both tones are played. The pattern repeats because the less frequent waves of the lower tone add to every other wave of the double. Similarly, tones 1, 2, and 4 add into a repeating wave pattern: large, small, medium, small, large, small, medium, small. Every 4th wave is large, with medium waves halfway between the large waves, and small waves halfway between the medium and large waves. This pattern of doubles, and patterns including even more doubles played at the same time, all sound very nice.

    Long ago, doubles were called octaves. Doubles are so basic to music and so easy that they are not usually considered part of harmony. The harder task of choosing tones between the doubles and blending two or more tones together is known as harmony. Ratios such as 1 : 1.5 or equivalently 2 : 3 are harmonic because the two tones combine into a pattern of air pressure waves easy to hear: large, small, small, large, small, small, etc.  Harmony can be understood by starting with the usual choices of tones available on standard keyboards. But an easier method is to start at the beginning and use simple math to choose musical scales.

    Many tuning systems are possible, including linear, log, or reciprocal. Linear tuning is easy to understand because the increase in frequency from each tone to the next is constant. For example, the series 1, 1.25, 1.5, 1.75, and 2 has a constant increase of .25 between each tone. Log tuning is another common system in which tones are equally spaced on the log of frequency rather than frequency scale. This makes the ratios rather than increases constant from one tone to the next. Reciprocal is a third system in which tones are obtained as reciprocals of the linear tuning frequencies. Reciprocal tuning results in the same tone ratios as linear tuning, but in the opposite order. Math allows artists to choose different sets of tones and to make scales scalable.


Scalable Scales

    A scale is a list of the tones available from one tone up to its double. Higher or lower tones outside the range 1: 2 can be obtained by multiplying or dividing the original frequencies by 2, or 4, or 8, etc. The tones in the scale can be set with simple formulas that allow artists to choose more or fewer tones per double, resulting in scalable scales. Selecting the number of tones in the scale is similar to buying boxes of 8, 16, or even 64 color crayons. As you choose more tones or colors you get less change from one to the next.

    Musical scales require compromises between several goals. The tones chosen should 1) be evenly spaced for simplicity, 2) have simple frequency ratios to improve harmony, 3) have enuf tones to provide choice but not so many that the ear cannot hear them all, and 4) have the same number of tones as beats in a musical measure so that scales and measures are in step.

    Goal 1) is met if the frequency of each tone is a constant ratio of the previous tone and the number of tones is the same within each doubling of frequency. Goal 2) is met if the tones are spaced evenly on the frequency scale instead of the log scale. Goal 3) is met if scales have fewer tones per double (2-6) for beginners and more tones (7-24) for more advanced musicians. Goal 4) is met if scales have 3, 4, 6, or 8 tones per double because most music is based on measures with those beats and few songs are written with 5 or 7 beats per measure or higher primes. Then, a scale could begin and end on the same beat of the next measure. All goals cannot be met at the same time, but modern electrical instruments can make more choices easily available.

    Scalable scales can be produced using linear tuning, log tuning, reciprocal tuning, or other tuning systems. If w represents the number of tones desired per double, then the following formulas can be used to set the tones. With linear tuning, tone n gets a frequency of (1 + n/w). With log tuning, the formula 2 to the power (n / w) is used instead. With reciprocal tuning, the formula is 2 / (1 + n/w). With two tones per double (w=2), the tone chosen between the doubles is 1.5 with linear tuning, 1.414 with log tuning, and 1.333 with reciprocal tuning. More tones are obtained between the doubles by setting w equal to 3, 4, 6, 8, 12, or other numbers.

    Fewer tones result in fewer wrong notes. More tones too closely spaced result in poor harmony because the wave series takes too long to repeat and the ear cannot pick up the pattern. The worst harmony results from tones with ratio 1 : 1.03 because higher ratios have shorter repeat lengths and ratios closer to 1 begin to sound like the same tone (no harmony). Similarly, 3% above and below ratios with nice harmony such as 1 : 1.5 are ratios with bad harmony such as 1 : 1.55. Because ratios with best and worst harmony are so close, singing can be difficult. If you try to sing the best tone and miss it by 3% you sing the worst tone instead.

    All tones have nice harmonic ratios in scales having 4 or fewer tones per double (w=4) if tuning is linear or reciprocal. Then, a beginner or child can play any or all of the available tones and never hit a wrong note. Simple math can produce better music, but scalable scales are not yet available because of the key pattern on the standard keyboard.


Keys and Keyboards

    The standard keyboard was invented hundreds of years ago and is the foundation of current music. The 7 repeating letters A, B, C, D, E, F, and G were engraved onto organ keyboards in Europe as early as the year 1090. The earliest keyboards had just the front row of keys with 7 instead of 12 tones per double. In about1350, “new” keys for sharps and flats were added in an uneven pattern in a back row. This arrangement allowed organists trained on the “old” keyboard without sharps and flats to continue playing the same old songs. The standard keyboard survived for several hundred years because the tones were reasonable, because all Christian churches used it, and because a standard used for so long by so many was hard to change.

    The standard scale probably developed by trial and error rather than by math. The uneven spacing of the 5 black keys gives better harmony to the 7 white keys than the previous evenly spaced keys. The standard musical scale does not start at tone A but instead at C. It includes relative frequencies 1, 1.125, 1.25, 1.333, 1.5, 1.667, 1.875, and 2. These tones happen to be very close to tones produced by the log tuning system with 12 tones per double: 1, 1.122, 1.26, 1.335, 1.495, 1.682, 1.888, and 2. The early organ builders probably didn’t use logarithms to determine pipe length and diameter but instead probably used their ears to find simple frequency ratios with nice harmony.

    Linear tuning with 8 tones per double produces many of the standard tones exactly: 1, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, and 2. Linear tuning with 3 tones per double produces the remaining standard tones 1.333 and 1.667. The linear math is easier to understand than standard theory and also can produce better harmony. For example, the nice sounding chord 1 : 1.25 : 1.5 : 1.75 : 2 (equivalently 4 : 5 : 6 : 7 : 8) isn’t available on the standard C scale. Singing also may be simpler with linear scales because frequency increases are even and predictable.

    With a keyboard, one person can play several notes at the same time. With most other musical instruments such as brass and woodwinds, each musician plays only one tone at a time. Some exceptions are harmonicas and bowed instruments which let the musician play two adjacent tones, and the guitar with its multiple strings (commonly 6 or 8) that can all sound at the same time. Such multi-tone instruments are tuned with harmonic tones side by side and have fewer notes per doubling of frequency than the piano. Thus, the increase in frequency from one guitar string to the next is greater than the increase in frequency from one standard piano key to the next.  Similarly, the keys of electric keyboards could be rearranged so that the tones beside each other sound good when played together.

    Scalable keyboards with evenly spaced keys let math be applied more easily. Standard keyboards can’t easily be tuned to have fewer or more tones per double because then each double would contain a different pattern of black and white keys. Some basic principles of scalable keyboards are covered in another document.


Notes and Notation

    Music notation is based on the standard keyboard and does not support the new tuning systems. Standard notation is difficult if all 12 notes are used. Five sharps or flats and five naturals are needed to record a simple 12-note scale. New notation is needed.


Voice and Verse

    Before music and musical instruments were invented, people began to talk. Most of the things they said weren’t worth repeating, but some of their more important ideas and feelings were put into poems and songs. Words were easier to remember if they are repeated with a distinct tempo, pattern, rhyme, and melody. Music without words is also useful to express feelings and simply to entertain, but perhaps the main use of melodies and music is to bring words to life. Some lessons last longer when sung in pleasing songs or when accompanied by well tuned tones.