When one of the residents of the National Zoo in Washington recently revealed her love of music to zookeepers there, some ears perked up. Shanthi, a 36-year-old Asian elephant loves playing (with) her harmonica.

"She's just so interested in finding ways to make interesting noises," says elephant keeper Debbie Flinkman. "If a lock makes noise she'll flip the lock repetitively. She will blow across the top of toys that we have drilled holes in."

And when Flinkman tied a harmonica to the wall in Shanthi's enclosure, the elephant wouldn't stop blowing in it.

"It's not usually a long ditty but it always ends in this really big sort of fanfare at the end," Flinkman says, "this big blowout."

That sparked some questions: Are the noises Shanthi is making music? And what is music? Why do we have it?

"It was an evolutionary accident," says Dan Levitin, a professor of psychology and neuroscience at McGill University who has written books and papers on why we have music and why we like it.

Levitin says the accident idea is a big one. It went public back in 1997 when Harvard professor Steven Pinker, a world-renowned author and experimental psychologist, got up in front of a group of musicologists and cognitive scientists at a meeting and said words to the effect of, "You're all wasting your time because music is cheesecake."

Auditory cheesecake.

"Cheesecake is interesting," Levitin explains. "We have this great fondness for it, but we didn't evolve a taste for cheesecake. In our hunter-gatherer days, it was an adaptive strategy to load up on fats and sweets because they were very hard to find."

So because humans, for other reasons, like fats and sweets, we like cheesecake too. It doesn't mean that cheesecake serves an evolutionary purpose, goes the argument.

"And he said the same thing applies to music: that our brains evolved language, and music just hopped along for the evolutionary ride," he says.

Take the idea of a beat. Is the beat an accident? Researchers tried to train macaque monkeys for four hours a day, six days a week for a year just to tap their fingers in time to a metronome. But the monkeys couldn't do it.

But a cockatoo named Snowball? That bird can dance. Watch:

"Species that do this seem to be species that do vocal mimicry," says Greg Bryant, an assistant professor in the Department of Communication Studies at UCLA. He says cockatoos got their beat ability by accident. It helps them mimic sound and vocal phrases from their parents that they'll need to know later to get a mate or to shoo something out of their territory.

"So that might be the evolutionary origins of our ability, too, since we also can do vocal mimicry," Bryant says.

But just because it's an evolutionary accident in animals, does that mean our music, human music, is an accident too?

Ellen Dissanayake, an author who has written about the evolution and the purpose of art, says no — we definitely have music for a reason.

"All over the world, adults behave with their babies in ways they don't with each other," she says. "They make funny facial expressions, move their heads and bodies in different sorts of ways and they talk in a higher pitched tone with a lot of repetition, a lot of vocal contours, so that is, I think, very musical."

That universally sing-songy kind of duet between mothers and babies, she says, could have been the kernel, a million years ago, of what we know as music. She says it could have started as an emotional bonding system. And it worked not just for mom and baby, but for mom and neighbor and everyone around the campfire. That may be how we went from baby talk to Beethoven.

A lot of theorists believe music served this purpose of just getting along in groups.

Copyright 2016 WAMU-FM. To see more, visit WAMU-FM.