HOW DID SOUNDS made by primitive humans evolve into music? For that matter, how have so many species on this planet come to create beautiful, meaningful sound -- from bird song to the complex buzzing of fruit flies?

The origins of life's first musical tones on Earth are as obscure as the beginnings of human language -- to which they may be closely tied. Yet, over 2,000 years ago, ancient Greek philosophers, puzzled by the beauty of music, began connecting harmonies to mysterious mathematical ratios. And recently, researchers have been turning to music for clues to how humans perceive the world and what it means for a brain to possess consciousness.

But what is music? What compelled lifeforms to create it? How and why did symphonies of Beethoven and concerti of Bach crawl out of matter on this small globe?

Writes mathematician Douglas Hofstadter, in his recent book "Metamagical Themas," "To me, the deepest and most mysterious pattern of all is music -- a product of the mind that the mind has not come close to fathoming yet."

The wonder of human musical ability is that it seems to be such an evolutionary "excess." What survival value for our species should we attribute to musical composition in its most sophisticated forms? For that matter, which came first, singing or talking?

It is difficult to identify any animal or insect species that doesn't rely on acoustic communication. In some of these, the use of sound has risen to a level that is indisputably musical, from the trills of birds to the underwater serenades of whales. This terrestrial symphony is driven by mating urges, territoriality, and the need to coordinate group movements. And humans demonstrate vestiges of these drives in nightclub and mood music to promote pairing, national folk music to demarcate kingdoms, and martial music to inspire soldiers.

Sound is a remarkably efficient communication channel. For example, sound bends around corners and allows an animal to broadcast its territorial claims without traversing its entire domain. So it is not surprising that auditory communication has played a major role in natural selection among animals.

During the first months of life, if some male song birds are deprived of the opportunity to hear other birds sing, they later sing poorly even when exposed to good singers. But those listening to recorded bird songs played for them as early as 10 days after hatching have sung proficiently.

This has led to the "auditory template theory of song learning" which holds that birds have some innate capacity to sing. A bird hearing normal song modifies its internal "template" with learned information to match the local dialect of calls. This parallels human learning in which innate syntax serves as the foundation for a particular language.

Roughly, then, music and language involve the same hardware but different software. In fact,some researchers have found that birds can break a song into "syllables" that they can then rearrange into new songs. Using these phonetic units, a bird may conform to local song fashions, yet each male territorial bird can establish his own musical trademark.

Whales, for that matter, have been discovered to sing with regional accent, Pacific humpbacks having a different dialect than those in the Atlantic. And zoologist Roger Payne and his former wife Katherine, a musicologist turned zoologist, have documented the rapid cultural evolution of humpback songs into new forms every few months.

Even fruit flies have been discovered to have hundreds of distinct "songs" created by rapidly vibrating wings. Researchers have found that fruit flies use these songs -- audible only a few centimeters away -- to identify and then mate with other members of their species.

Among the lower animals, musical communication gives some individuals a survival advantage that promotes the dominance of their biological strain.

The whole process may have begun hundreds of millions of years ago when primitive movements of animal bodies, not designed to produce sound, were fruitfully noisy -- leading to advantageous communication between creatures. Michael Bright speculates that the first meaningful sounds may have come from primitive trilobites, 500 million year-old relatives of the horseshoe crab: "We shall probably never know, although someone, some day, may find a trilobite with structures that can only be interpreted as organs for producing sound."

But what role has music had in human evolution?

Music does have parallels with other evolutionary mysteries -- biochemistry, for example, in which simple atoms combine to create elegant complexity and then inexplicably, almost miraculously, life.

Similarly, music begins as nothing more than waves of compression moving through a medium like air. These pressure waves are transduced into electrical impulses that feed into brains by way of the most exquisitely evolved biological machinery -- ears.

Yet music is so much more than a summation of frequencies. Our emotional response to music goes far beyond a note-by-note recognition of frequency, duration, and amplitude. Indeed, music dissected, heard one note at a time, is obviously no longer music. Simultaneously -- unlike painting -- music can't be appreciated all at once. Visual art can be viewed at a glance. Music is a phenomenon that by definition is spread out over time.

The musical experience could be described as a complex reverberation within the networks of the brain that is highly influenced by previous conditioning. Every nuance of one's physical and mental state comes together to transform sounds into higher-level feelings. "At a given moment a certain note is being played but a number of previous notes are 'reverberating' in consciousness," writes physicist David Bohm in his book, "Wholeness and the Implicate Order."

Both Hofstadter and Bohm believe that music involves a transformation of life into a temporally experienced pattern. Computers, for example, can generate notes at random, constrained somewhat by "rules" of harmony and esthetics. But this "music" is pallid compared to what the human spirit has been able to create, and Hofstadter calls the suggestion that it will soon be otherwise a "grotesque and shameful misestimation of the depth of the human spirit."

He says that a program that could produce music like Chopin's or Bach's "would have to wander around the world on its own, fighting its way through the maze of life and feeling every moment of it. It would have to understand the joy and lonleiness of a chilly night wind, the longing for a cherished land, the inaccessibility of a distant town, the heartbreak and regeneration after a human death. . . . Therein and therein only lie the sources of meaning in music."

But where did music begin, and how did it influence the evolution of human culture? Some have speculated that human consciousness and language blossomed simultaneously during the last 100,000 years, impelled by still-disputed forces. It is hard to imagine that the peoples of pre-history didn't get some of their musical inspiration from birds and other wildlife during that time.

In the history of science, music has influenced humanity in ways that are almost mystical. The Greek philosophers were impressed by the whole-number ratios in the lengths of vibrating strings that produced pleasing harmonies. To them, it was no coincidence that the seven notes of their scale were apparently in synchrony with the spacing of what they thought of as the seven classical planets (including the Sun and the Moon)

In "Music of the Spheres," author Guy Murchie quotes Hippolytos (c. 400 B.C.): "Pythagoras maintained that the universe sings and is constructed in accordance with harmony; and he was the first to reduce the motions of the seven heavenly bodies to music and song." Thus was born the idea of "music of the spheres." This musically induced mystical speculation helped send Greek science down a path that we are still following.

In the 16th century, Johannes Kepler discovered the true principles behind planetary orbits, which soon helped Isaac Newton to develop his theory of universal gravitation that was so seminal in Western scientific development. But Kepler, not satisfied with his bare mathematical laws, later produced music that he thought represented each planet's "harmony" -- "Harmonica Mundi" ("Harmony of the World"). Recapitulating Pythagoras, he mystically connected the vibrations of strings with the velocities of planets.

Many have commented on the strong apparent correlation between an attraction to science and an affinity for music. The great 18th-century English astronomer, William Herschel, earned his living as a noted musician and composer before he found a patron for his astronomical observations. Albert Einstein was almost as fond of his violin as theorizing. Musical scientists are legion. Some have suggested that the patterns in music and the regularities in nature may appeal to the same kind of mind.

Some scientists have traveled beyond emotional or mystical tinkering with music and have tried to fathom underlying patterns in its esthetic appeal. The problem in discovering these patterns is that much good music seems precariously balanced between confusion and regularity.

Composer Lejarin Hiller Jr. has said, "Music is a compromise between monotony and chaos." Guy Murchie wrote, "A composer, then, with an eye to physical theory need only mask the entropy disorder of his music low enough to give it some recognizable pattern yet at the same time high enough for an element of surprise and individuality, and he may be well on his way toward a judicious compromise between the Scylla of wanton discord and the Charybdis of dull monotony!"

Taking up this tightrope challenge, physicist Richard Voss has discovered a way in which good music may reflect statistical properties of the natural world. Voss has built his computer-generated music around the ideas of Benoit Mandelbrot, whose theories of natural geometry seem to apply as much to music as to the visual arts.

With his "fractal geometry of nature," Mandelbrot found order in seeming disorder -- mathematical regularities in things as disparate as the convolution of clouds and the jaggedness of mountain ranges. Voss now claims that computer-generated music with "fractal" statistics is much more pleasing than earlier computerized music without that natural flair.

Martin Gardner, describing this work in Scientific American, says, "one can create 'mountain music' by photographing a mountain range and translating its fluctuating heights to tones that fluctuate in time. If we view nature, statistically, frozen in time, we can find thousands of natural curves that can be used in this way to produce stochastic random music."

Good music mixes order and surprise. Gardner says that Voss has given mathematical measure to this well-known mixture: "How could it be otherwise? Surprise would not be surprise if there were not sufficient order for us to anticipate what is likely to come next. If we guess too accurately -- say in listening to a tune that is no more than walking up and down the keyboard in one-step intervals -- there is no surprise at all. Good music, like a person's life or the pageant of history, is a wondrous mixture of expectation and unanticipated turns."

Would people from another planet understand our music and its mathematical foundations?

Clearly this is a question in league with the debate over whether mathematics is truely a universal language -- understandable in the same way by vastly different forms of consciousness. But this has not stopped both scientists and theatrical artists from proposing musical forms of interstellar communication.

Recall the melodies employed to communicate with the aliens in Stephen Spielberg's movie, "Close Encounters of the Third Kind." Now traveling to the stars aboard the Voyager I and II spacecraft are long-playing copper records that each contain 90 minutes of music from many lands and cultures. What will happen in the unlikely event that aliens ever come upon this tiny relic? Will they appreciate it as "music" or will it be to them a bizarre form of noise? Not important, say the scientists and musicians who collaborated in selecting the music. The copper disks were really intended to be "messages to Earth" -- a statement of the ideal harmony between peoples of this now strife-torn planet.

But suppose "music between the spheres" really is part of the usual conversations between members of the galactic club. Could that afford the ultimate evolutionary explanation of our staggeringly overdeveloped musical skill? Could it be that the "purpose" of music is a kind of cosmic social glue connecting distant worlds -- much as terrestrial music has the power to transcend national boundaries?

Maybe whispers of alien music are at this moment irradiating the globe, undetected and unrecognized by our finest instruments. Some day we may be smart and patient enough to capture and enjoy celestial melodies if they are there for the taking.

But for the moment, we are mere Earth-bound babblers casting our music onto the radio waves of the cosmic ocean. Two copper discs are now slowly traversing space, on them the sounds of animals and the songs of people -- introduced by the haunting music of the planets, Kepler's "Harmonica Mundi." They are our music beyond the spheres.