A few years ago, electrical engineer Bill Sethares recorded some rock music.

While hiking shale cliffs surrounding Chaco Canyon in New Mexico, he became captivated by the scraping and clattering of flat, reddish stones underfoot. He hit them with sticks, struck them with mallets and beat one against the other, capturing the reverberations on the tape recorder he always carries. The tape revealed a surprising resonance and range of musical tones from the stones.

Like some other kinds of rock music, it was not entirely pleasing to the ear. But it did have elements of what we call harmony, a quality that humans developed by using a particular pattern of sounds known as a musical scale.

From the ancient Greeks to 15th century monks to Puff Daddy and Britney Spears, people have used these distinctive series of pitches, or notes, to create myriad delightful musical expressions.

Indeed, Chinese archaeologists recently announced that they had unearthed the world's oldest known playable musical instrument, a seven-hole flute about 9,000 years old. Made from the wing bone of a large bird, the flute relies on a musical scale.

The musical note that hits your ear is a pressure wave traveling through air. As the sound wave passes, it alternately packs together and spreads apart molecules of air, creating oscillations that ultimately beat against the eardrum.

Each wave has a particular fundamental frequency, the number of complete cycles it makes in one second. For instance, a wave vibrating 200 times per second, or 200 hertz (abbreviated Hz and named for German physicist Heinrich Hertz) causes air molecules to move back and forth 200 times each second. The greater the frequency, the higher the pitch.

Humans can hear frequencies as low as 20 Hz and as high as 20,000 Hz. Within that range, any tone that vibrates twice as fast as another has a special relationship with the first: When the two are played together, they form a sound that is extremely pleasing.

In Greece during the 6th century B.C., the mathematician Pythagoras became fascinated by this ratio as well as similar musical relations among the numbers 2, 3 and 4.

Pythagoras made his discoveries using a single-stringed instrument called a monochord [see illustration below]. Like the fret of a guitar, a raised region divides the monochord's string into two lengths. The bridge can be moved, allowing the string to be divided into two segments of any length. The shorter the segment, the higher the frequency.

Pythagoras and his followers found that, when one length is exactly twice the other, the two plucked together make beautiful music. This ratio of tones -- now known as the octave because it spans eight notes in the Western scale -- plays a fundamental role in sounds produced by countless musical instruments around the world. New evidence suggests that people knew about octaves as long ago as 7000 B.C., and the concept reigns supreme in the music of nearly every human culture.

A westerner traveling to India or China may find traditional music played there downright weird, as might a native of India or Asia who had never before heard rock and roll. Yet each is based on the octave. The difference lies in how each culture divides the octave into a set of individual tones. Each division leads to a different musical scale.

Dividing the octave isn't arbitrary but is strongly influenced by the specific instrument -- drums, bells or piano -- on which a particular culture relies to make music.

A tune played on gongs sounds great to the people of Indonesia and would to us, too, once we became accustomed to the sounds. But it would sound terrible on the piano, notes engineer Neville Fletcher of the Australian National University in Canberra.

The octave intrigued Pythagoras but didn't deafen him to other pleasing pairings of notes. He discovered, for instance, that a string divided so that one part is precisely 1112 times as long as the other also sounds a harmonious interval. That interval is known as the "perfect fifth."

To see why, go to the piano keyboard. Ignore the black keys. Strike the note called middle C [see illustration above]. Modern musical notation starts with the letter C rather than A, but one 9th century arrangement used A as the first note.

Then go four white keys to the right. If we refer to the first note, middle C, as the first degree, then G is the fifth degree. Thus, the interval from C to G came to be known as the fifth.

The Pythagoreans also found a pleasing set of tones when one section of the string is exactly 1113 times that of the other. That interval is represented on the piano by striking C and F together. Since F is the fourth degree, this harmonious interval is called the "perfect fourth."

From these ratios came the fundamental arithmetic of the musical scale. But why do the notes sound so special? When you pluck a string, it reverberates not only at its fundamental frequency, call it f, but also at whole-number multiples of that frequency: 2f, 3f, 4f, 5f, 6f and so on. These are called "harmonics" [see illustration at lower left].

Now pluck a second string half as long as the first. Its fundamental frequency is 2f, one octave higher. As with the longer string, its overtones are integer multiples of its fundamental frequency: 2(2f), 3(2f), 4(2f), 5(2f) and so on.

A comparison reveals that the overtones of the second string align with those of the first. In a sense, the tones of the longer string contain the tones of the shorter one.

You can test this with an experiment conceived by Leonard Bernstein, the late composer and conductor. Very carefully depress the middle C key on a piano. Do it so gently that it doesn't actually make a sound. Now sharply strike and release the C an octave below.

You will also hear middle C, even though you never sounded it. As Bernstein explained, depressing the middle C key releases the damper on the middle C strings, allowing them to vibrate freely. They do so, in synch with the first overtone of the C you struck one octave below.

Bottom line: Any note will sound not only as the note struck but also as all of its overtones.

"This explains why the note and its octave tend to merge together, to be smooth and harmonious," Sethares writes in his book Tuning, Timbre, Spectrum, Scale.

"There's something the same about these two notes [an octave apart], even though they're completely different pitches," composer Peter Schickele says on his nationally broadcast radio program, The Schickele Mix.

"This is reflected in the way we name the notes. We don't have completely different names for all the 88 keys of the piano. We go a-b-c-d-e-f-g, and then we start over again . . . . If you take a color and double the number of vibrations, you just get another color, nothing particularly to do with the first color. But with sound, it's different."

Intoxicated by their success with the monochord, Pythagoras and his followers constructed a vision of the entire universe based on the musical ratios. The regular motion of the planets and the nature of heaven and Earth all ring to the same music, according to the Pythagoreans of 500 B.C. Legend has it that only Pythagoras himself could hear the divine melody.

Centuries later, German astronomer Johannes Kepler (1571-1630) cited a heavenly "music of the spheres" created by the planets as they orbited the sun in precise ratios to each other.

Some thinkers went so far as to imagine a cosmic monochord [see illustration below]. That charming vision has since given way to a more complex view of the cosmos, but the phrase "music of the spheres" endures.

Using only the octave, the fifth and the fourth -- the recipe laid out by Pythagoras and his followers -- one can build a complete scale of 12 notes. On the piano, that's represented by the seven white keys and five black ones.

Before the 11th century, however, musicians were content with just seven notes. The flats and sharps, slowly added over the next 300 years, became musically necessary only as instruments became more refined and could reliably produce a wider selection of notes within an octave.

The Pythagorean method provides the largest number of perfect fourths and fifths -- but at a price. That problem didn't become apparent, however, until the organ pipe came of age.

The original instructions for building an organ closely followed the Pythagorean prescription. Start with a pipe of a particular length that sounds the note C. Divide the pipe into fourths and take one part away. Now you have a pipe that plays the note F, a perfect fourth. The frequency of F relates to C by the ratio 4:3. And so on.

But when organists tried to play two or more notes together, some would clash. The fault lay not in the instrument, notes Thomas Levenson in his book Measure for Measure, "but in the arithmetic of sound itself."

It's a matter of multiplication. Using the Pythagorean system, the octave derived by going up the scale by a succession of fifths or fourths leads to a mismatch. Instead of doubling the frequency of the first C, the second C becomes 2.0273 times the frequency. That difference, known as the "Pythagorean comma," sounds jarring enough to set the teeth on edge.

To eliminate the discord, a musician selected one of the fifths and made it smaller by just the amount needed to keep the octaves in synch. The mismatch remained but was simply displaced, like robbing Peter to pay Paul. This imperfect fifth was called the wolf tone, named for its howl.

"The moment that harmony seemed a good idea, the only issue was where to put the dissonances, the imperfections, imposed by the arithmetic of sound," Levenson writes.

Musical notes were deliberately held slightly out of tune in order to preserve the octaves. By the end of the 15th century, musicians began to experiment with other tunings. The idea was to spread the dissonance over a larger number of notes, rather than putting all of the burden on a single fifth interval.

Known as mean-tone tuning, some combinations of keys were still dissonant in this system, and a gentler snarl of the wolf lingered.

As musical instruments became more precise and composers expanded their range of notes, efforts were made to invent a scale in which a musician was free to use every tone available. About 1700, Bartolomeo Cristofori, an Italian harpsichord maker, built the world's first piano.

Next March, the Smithsonian Institution plans to open a year-long exhibit celebrating the 300th birthday of this invention, actually called the pianoforte from the Italian words for soft and loud. The piano greatly expanded the range of tones. Howling wolves and forbidden notes be gone!

In the 1720s and 1730s, Johann Sebastian Bach became intrigued by a new tuning known as "well-tempered." In that scheme, the Pythagorean imperfections were almost, but not quite, evenly distributed across the notes of an octave.

What better way to advertise the new tuning than to compose keyboard pieces using it? Bach's famous collection of compositions, The Well-Tempered Clavier (clavier means keyboard), demonstrated the beauty and flexibility of the scheme.

The modern musical scale uses an even more democratic tuning known as equal temperament, in which the mismatch is spread exactly evenly between the notes. In this scale, the octave is divided into 12 equal intervals, and the ratio of adjacent notes, call it a, solves the equation a12 = 2.

Indeed, each note in equal temperament is higher in frequency than its neighbor by a factor of the 12th root of 2, approximately 1.05946. That may seem like an ugly number, but by definition it is just what is required to ensure that successive octaves keep the perfect ratio of 2:1 [see keyboard illustration at left].

So in equal temperament, the difference in frequency between adjacent notes grows larger over the scale, but the ratio of frequencies stays the same.

Recently, there's been a move afoot to recapture the richness of some older temperaments. Tunings that embrace both pure harmony and slight dissonance create a musical tension not found in equal temperament, says Edward Foote, an instrument tuner in Nashville.

Foote is on a mission to spread the word that different temperaments suit different compositions, rather than one size fits all. His customers, pianists who normally play only in the modern tuning, are beginning to agree.

The well temperament, he notes, "is what Beethoven grew up around, this is what Mozart lived in the middle of, this was the only tuning available until the late 1850s." Yet for the last century, everyone has been playing his or her composition on pianos tuned to the equal temperament.

"I am finding that people become very emotionally involved listening to well-tempered piano music, whereas they don't as much when it is in equal temperament," Foote says. Classical pianists using the older tuning are "hearing things they've never heard in the music. To me, this is the edge of the revolution."

Spurring that revolution is the development of computer software. Now, with just the push of a button, musicians can choose a tuning used by composers centuries ago. At the same time, electronic synthesizers are spurring modern composers to explore new harmonies.

"I use the computer to do things that you can't do with traditional instruments," says Robert Gibson, a composer and music theory teacher at the University of Maryland. Whether it's finding the musical pattern in ocean waves or creating an unfamiliar sound, the computer "sparks my musical imagination," he says.

It strikes a chord in other fields as well. Just as Sethares found a sort of harmony in the rock music of Chaco Canyon, other scientists have begun exploring an unearthly music.

Italian physicist Fiorella Terenzi records microwaves, a kind of radio wave, emitted by several distant galaxies. Slowing these frequencies until they fall into the audible range, Terenzi creates a sort of rhythm that she calls acoustic astronomy. Think of it as space music. The eerie sounds do have an otherworld quality about them.

"Amazingly enough," Sethares says, "outer space sounds just like you always thought it would." Amid the noise, he notes, a harmonic pattern weaves in and out.

Pythagoras would have loved it.

Ron Cowen, a staff writer at Science News, last wrote for Horizon about George Gershwin.

CAPTION: APPROXIMATE FREQUENCIES; Each octave in the modern "chromatic" scale contains 12 tones -- represented on a piano by the seven white keys and five black keys -- with precisely the same ratio between the frequencies of any two consecutive notes.

The higher C is exactly twice the frequency of the lower C (shown here as middle C). So the ratio (call it R) between notes must be such that:

RxRxRxRxRxRxRxRxRxRxRxR=2.

The number that, when multiplied by itself 12 times, equals 2 is 1.05946. So if A is 440 Hz (the note that orchestras typically tune on, also popular in tuning forks and pitch pipes), then A-sharp must be about 466 Hz and B 494 Hz.

CAPTION: At right: One of the first modern pianos made in Florence by Bartolomeo Cristofori in 1726.

CAPTION: This woodcut from 1492 depicts Pythagoras experimenting with monochord strings of different tensions. By sliding a bridge back and forth, as in the diagram below, he found that simple mathematical ratios between string lengths determine whether tones sound pleasing together. Those that do are harmonic variations on a basic, fundamental tone. In the example below, if the frequency of the fundamental is f, the first overtone is 2f, the third 3f and the fourth 4f.

CAPTION: Many thinkers, following Pythagoras, thought the orderly procession of the heavens is fundamentally musical. This illustration, from French savant Marin Mersenne's Universal Harmony (1636), shows God's hand at the top of the heavenly instrument, at high G. The scale then extends downward through the solar system to the sun at middle G, and then to Venus, Mercury and the elements of fire, air, and water until it reaches the bottom G, Earth.

CAPTION: During the Middle Ages, the image of the hand often was used as a memory aid to help students learn the relationships between notes of the scale, or "gamut." This one dates from the late 15th century.