What a great question! And it happens to be one that Darwin himself pondered.
The main train of biological thought on this is that before people
learned to communicate with words, they had only sounds at their
disposal and -- much like birds or crickets -- used music-like sounds
and rhythyms to express strong emotions.
Here's Charles Darwin on the topic, in The Descent of Man:
?... it appears probable that the progenitors of man, either the males
or females or both sexes, before acquiring the power of expressing
their mutual love in articulate language, endeavoured to charm each
other with musical notes and rhythm.?
Of course, from a strictly Darwinian point of view, for music to
endure as an important evolutionary trait, it must play a role in
human sexual selection (which, as noted in the comments below, was
certainly the case for Maria and Capt. von Trapp).
An excellent overview of this strictly-evolutionary interpretation can
be found in this paper by Geoffrey F. Miller:
Evolution of human music through sexual selection
and I can't help excerpting this (slightly silly, but still on point)
quote about Jimi Hendrix:
Consider Jimi Hendrix, for example. This rock guitarist
extraordinaire died at the age of 27 in 1970, overdosing on the drugs
he used to fire his musical imagination. His music output, three
studio albums and hundreds of live concerts, did him no survival
favours. But he did have sexual liaisons with hundreds of groupies,
maintained parallel long-term relationships with at least two women,
and fathered at least three children in the U.S., Germany, and Sweden.
Under ancestral conditions before birth control, he would have
fathered many more. Hendrix?s genes for musical talent probably
doubled their frequency in a single generation, through the power of
attracting opposite-sex admirers. As Darwin realized, music?s
aesthetic and emotional power, far from indicating a transcendental
origin, point to a sexual-selection origin, where too much is never
enough. Our ancestral hominid-Hendrixes could never say, ?OK, our
music?s good enough, we can stop now?, because they were competing
with all the hominid-Eric-Claptons, hominid-Jerry-Garcias, and
hominid-John-Lennons. The aesthetic and emotional power of music is
exactly what we would expect from sexual selection?s arms race to
impress minds like ours.
The paper then goes on to summarize Darwin's take on music, which he
found to be one of the most mysterious and hard-to-explain of human
traits, from an evolutionary point of view. But explain it he does,
and all from the point of view of music's influence over sexual
?All these facts with respect to music and impassioned speech become
intelligible to a certain extent, if we may assume that musical tones
and rhythm were used by our half-human ancestors, during the season of
courtship...The impassioned orator, bard, or musician, when with his
varied tones and cadences he excites the strongest emotions in his
hearers, little suspects that he uses the same means by which his
half-human ancestors long ago aroused each other?s ardent passions,
during their courtship and rivalry?
The rest of Miller's paper goes on to explore the evolution of music
in humans from the perspective of our updated understanding of
evolution. But the crux of it is the same...music evolved as a compex
human behavioral trait because it conferred long-ago advantages to our
ancestors as they made their choices regarding mates.
Or...as they say...music is the language of love!
Let me know if there's anything else you need on this.
search strategy -- Google search on [ music "human evolution" ]