The Atlantic has a very good article on the subject which even raises the question if humans were, in fact, the inventors of music. Take a read:
Music is everywhere, but it remains an evolutionary enigma. In recent years, archaeologists have dug up prehistoric instruments, neuroscientists have uncovered brain areas that are involved in improvisation, and geneticists have identified genes that might help in the learning of music.
Yet basic questions persist: Is music a deep biological adaptation in its own right, or is it a cultural invention based mostly on our other capacities for language, learning, and emotion? And if music is an adaptation, did it really evolve to promote mating success as Darwin thought, or other for benefits such as group cooperation or mother-infant bonding?