“IF MUSIC be the food of love, play on, give me excess of it.” And if not? Well, what exactly is it for? The production and consumption of music is a big part of the economy. The first use to which commercial recording, in the form of Edison's phonographs, was to bring music to the living rooms and picnic tables of those who could not afford to pay live musicians. Today, people are so surrounded by other people's music that they take it for granted, but as little as 100 years ago singsongs at home, the choir in the church and fiddlers in the pub were all that most people heard.

Other appetites, too, have been sated even to excess by modern business. Food far beyond the simple needs of stomachs, and sex (or at least images of it) far beyond the needs of reproduction, bombard the modern man and woman, and are eagerly consumed. But these excesses are built on obvious appetites. What appetite drives the proliferation of music to the point where the average American teenager spends 1½-2½ hours a day—an eighth of his waking life—listening to it?

Well, that fact—that he, or she, is a teenager—supports one hypothesis about the function of music. Around 40% of the lyrics of popular songs speak of romance, sexual relationships and sexual behaviour. The Shakespearean theory, that music is at least one of the foods of love, has a strong claim to be true. The more mellifluous the singer, the more dexterous the harpist, the more mates he attracts.

A second idea that is widely touted is that music binds groups of people together. The resulting solidarity, its supporters suggest, might have helped bands of early humans to thrive at the expense of those that were less musical.

Both of these ideas argue that musical ability evolved specifically—that it is, if you like, a virtual organ as precisely crafted to its purpose as the heart or the spleen. The third hypothesis, however, is that music is a cross between an accident and an invention. It is an accident because it is the consequence of abilities that evolved for other purposes. And it is an invention because, having thus come into existence, people have bent it to their will and made something they like from it.

She loves you

Shakespeare's famous quote was, of course, based on commonplace observation. Singing, done well, is certainly sexy. But is its sexiness the reason it exists? Charles Darwin thought so. Twelve years after he published “On the Origin of Species”, which described the idea of natural selection, a second book hit the presses. “The Descent of Man and Selection in Relation to Sex” suggested that the need to find a mate being the pressing requirement that it is, a lot of the features of any given animal have come about not to aid its survival, but to aid its courtship. The most famous example is the tail of the peacock. But Darwin suggested human features, too, might be sexually selected in this way—and one of those he lit on was music.

In this case, unlike that of natural selection, Darwin's thinking did not set the world alight. But his ideas were revived recently by Geoffrey Miller, an evolutionary biologist who works at the University of New Mexico. Dr Miller starts with the observations that music is a human universal, that it is costly in terms of time and energy to produce, and that it is, at least in some sense, under genetic control. About 4% of the population has “amusia” of one sort or another, and at least some types of amusia are known to be heritable. Universality, costliness and genetic control all suggest that music has a clear function in survival or reproduction, and Dr Miller plumps for reproduction.

One reason for believing this is that musical productivity—at least among the recording artists who have exploited the phonograph and its successors over the past hundred years or so—seems to match the course of an individual's reproductive life. In particular, Dr Miller studied jazz musicians. He found that their output rises rapidly after puberty, reaches its peak during young-adulthood, and then declines with age and the demands of parenthood.

As is often the case with this sort of observation, it sounds unremarkable; obvious, even. But uniquely human activities associated with survival—cooking, say—do not show this pattern. People continue to cook at about the same rate from the moment that they have mastered the art until the moment they die or are too decrepit to continue. Moreover, the anecdotal evidence linking music to sexual success is strong. Dr Miller often cites the example of Jimi Hendrix, who had sex with hundreds of groupies during his brief life and, though he was legally unmarried, maintained two long-term liaisons. The words of Robert Plant, the lead singer of Led Zeppelin, are also pertinent: “I was always on my way to love. Always. Whatever road I took, the car was heading for one of the greatest sexual encounters I've ever had.”

Anecdotal evidence linking music to sexual success is strong

Another reason to believe the food-of-love hypothesis is that music fulfils the main criterion of a sexually selected feature: it is an honest signal of underlying fitness. Just as unfit peacocks cannot grow splendid tails, so unfit people cannot sing well, dance well (for singing and dancing go together, as it were, like a horse and carriage) or play music well. All of these activities require physical fitness and dexterity. Composing music requires creativity and mental agility. Put all of these things together and you have a desirable mate.

Improve your singing…

A third reason to believe it is that music, or something very like it, has evolved in other species, and seems to be sexually selected in those species, too. Just as the parallel evolution of mouse-like forms in marsupial and placental mammals speaks of similar ways of life, so the parallel evolution of song in birds, whales and gibbons, as well as humans, speaks of a similar underlying function. And females of these animals can be fussy listeners. It is known from several species of birds, for example, that females prefer more complex songs from their suitors, putting males under pressure to evolve the neurological apparatus to create and sing them.

And yet, and yet. Though Dr Miller's arguments are convincing, they do not feel like the whole story. A man does not have to be gay to enjoy the music of an all-male orchestra, even if he particularly appreciates the soprano who comes on to sing the solos. A woman, meanwhile, can enjoy the soprano even while appreciating the orchestra on more than one level. Something else besides sex seems to be going on.

The second hypothesis for music's emergence is that it had a role not just in helping humans assess their mates, but also in binding bands of people together in the evolutionary past. Certainly, it sometimes plays that role today. It may be unfashionable in Britain to stand for the national anthem, but two minutes watching the Last Night of the Proms, an annual music festival, on television will serve to dispel any doubts about the ability of certain sorts of music to instil collective purpose in a group of individuals. In this case the cost in time and energy is assumed to be repaid in some way by the advantages of being part of a successful group.

The problem with this hypothesis is that it relies on people not cheating and taking the benefits without paying the costs. One way out of that dilemma is to invoke a phenomenon known to biologists as group selection. Biologically, this is a radical idea. It requires the benefits of solidarity to be so great that groups lacking them are often extinguished en bloc. Though theoretically possible, this is likely to be rare in practice. However, some researchers have suggested that the invention of weapons such as spears and bows and arrows made intertribal warfare among early humans so lethal that group selection did take over. It has been invoked, for example, to explain the contradictory manifestations of morality displayed in battle: tenderness towards one's own side; ruthlessness towards the enemy. In this context the martial appeal of some sorts of music might make sense.

Robin Dunbar of Oxford University does not go quite that far, but unlike Dr Miller he thinks that the origins of music need to be sought in social benefits of group living rather than the sexual benefits of seduction. He does not deny that music has gone on to be sexually selected (indeed, one of his students, Konstantinos Kaskatis, has shown that Dr Miller's observation about jazz musicians also applies to 19th-century classical composers and contemporary pop singers). But he does not think it started that way.

…and your grooming

Much of Dr Dunbar's career has been devoted to trying to explain the development of sociality in primates. He believes that one of the things that binds groups of monkeys and apes together is grooming. On the face of it, grooming another animal is functional. It keeps the pelt clean and removes parasites. But it is an investment in someone else's well-being, not your own. Moreover, animals often seem to groom each other for far longer than is strictly necessary to keep their fur pristine. That time could, in principle, be used for something else. Social grooming, rather like sexual selection, is therefore a costly (and thus honest) signal. In this case though, that signal is of commitment to the group rather than reproductive prowess.

Dr Dunbar thinks language evolved to fill the role of grooming as human tribes grew too large for everyone to be able to groom everyone else. This is a controversial hypothesis, but it is certainly plausible. The evidence suggests, however, that the need for such “remote grooming” would arise when a group exceeds about 80 individuals, whereas human language really got going when group sizes had risen to around 140. His latest idea is that the gap was bridged by music, which may thus be seen as a precursor to language.

The costliness of music—and of the dancing associated with it—is not in doubt, so the idea has some merit. Moreover, the idea that language evolved from wordless singing is an old one. And, crucially, both singing and dancing tend to be group activities. That does not preclude their being sexual. Indeed, showing off to the opposite sex in groups is a strategy used by many animals (it is known as lekking). But it may also have the function of using up real physiological resources in a demonstration of group solidarity.

Like cheesecake, music sates an appetite that nature cannot

By side-stepping the genocidal explanations that underlie the classical theory of group selection, Dr Dunbar thinks he has come up with an explanation that accounts for music's socially binding qualities without stretching the limits of evolutionary theory. Whether it will pass the mathematical scrutiny which showed that classical group selection needs genocide remains to be seen. But if music is functional, it may be that sexual selection and social selection have actually given each other a helping hand.

The third hypothesis, though, is that music is not functional, and also that Dr Dunbar has got things backwards. Music did not lead to language, language led to music in what has turned out to be a glorious accident—what Stephen Jay Gould called a spandrel, by analogy with the functionless spaces between the arches of cathedrals that artists then fill with paintings. This is what Steven Pinker, a language theorist at Harvard, thinks. He once described music as auditory cheesecake and suggested that if it vanished from the species little else would change.

Dr Pinker's point is that, like real cheesecake, music sates an appetite that nature cannot. Human appetites for food evolved at a time when the sugar and fat which are the main ingredients of cheesecake were scarce. In the past, no one would ever have found enough of either of these energy-rich foods to become obese, so a strong desire to eat them evolved, together with little limit beyond a full stomach to stop people eating too much. So it is with music. A brain devoted to turning sound into meaning is tickled by an oversupply of tone, melody and rhythm. Singing is auditory masturbation to satisfy this craving. Playing musical instruments is auditory pornography. Both sate an appetite that is there beyond its strict biological need.

Of course, it is a little more complicated than that. People do not have to be taught to like cheesecake or sexy pictures (which, in a telling use of the language, are sometimes also referred to as “cheesecake”). They do, however, have to be taught music in a way that they do not have to be taught language.

Words and music

Aniruddh Patel, of the Neurosciences Institute in San Diego, compares music to writing, another widespread cultural phenomenon connected with language. True language—the spoken languages used by most people and the gestural languages used by the deaf—does not have to be taught in special classes. The whole of a baby's world is its classroom. It is true that parents make a special effort to talk to their children, but this is as instinctive as a young child's ability (lost in his early teens) to absorb the stuff and work out its rules without ever being told them explicitly.

Learning to write, by contrast, is a long-winded struggle that many fail to master even if given the opportunity. Dyslexia, in other words, is common. Moreover, reading and writing must actively be taught, usually by specialists, and evidence for a youthful critical period when this is easier than otherwise is lacking. Both, however, transform an individual's perception of the world, and for this reason Dr Patel refers to them as “transformative technologies”.

In difficulty of learning, music lies somewhere in between speaking and writing. Most people have some musical ability, but it varies far more than their ability to speak. Dr Patel sees this as evidence to support his idea that music is not an adaptation in the way that language is, but is, instead, a transformative technology. However, that observation also supports the idea that sexual selection is involved, since the whole point is that not everyone will be equally able to perform, or even to learn how to do so.

Do they know it's Christmas?

What all of these hypotheses have in common is the ability of music to manipulate the emotions, and this is the most mysterious part of all. That some sounds lead to sadness and others to joy is the nub of all three hypotheses. The singing lover is not merely demonstrating his prowess; he also seeks to change his beloved's emotions. Partly, that is done by the song's words, but pure melody can also tug at the heart-strings. The chords of martial music stir different sentiments. A recital of the Monteverdi Vespers or a Vivaldi concerto in St Mark's cathedral in Venice, the building that inspired Gould to think of the non-role of spandrels, generates emotion pure and simple, disconnected from human striving.

This is an area that is only beginning to be investigated. Among the pioneers are Patrik Juslin, of Uppsala University, and Daniel Vastfjall, of Gothenburg University, both in Sweden. They believe they have identified six ways that music affects emotion, from triggering reflexes in the brain stem to triggering visual images in the cerebral cortex.

Such a multiplicity of effects suggests music may be an emergent property of the brain, cobbled together from bits of pre-existing machinery and then, as it were, fine-tuned. So, ironically, everyone may be right—or, at least partly right. Dr Pinker may be right that music was originally an accident and Dr Patel may be right that it transforms people's perceptions of the world without necessarily being a proper biological phenomenon. But Dr Miller and Dr Dunbar may be right that even if it originally was an accident, it has subsequently been exploited by evolution and made functional.

Part of that accident may be the fact that many natural sounds evoke emotion for perfectly good reasons (fear at the howl of a wolf, pleasure at the sound of gently running water, irritation and mother-love at the crying of a child). Sexually selected features commonly rely on such pre-existing perceptual biases. It is probably no coincidence, for instance, that peacocks' tails have eyespots; animal brains are good at recognising eyes because eyes are found only on other animals. It is pure speculation, but music may be built on emotions originally evolved to respond to important natural sounds, but which have blossomed a hundred-fold.

The truth, of course, is that nobody yet knows why people respond to music. But, when the carol singers come calling, whether the emotion they induce is joy or pain, you may rest assured that science is trying to work out why.