Alex was small, but precocious. He could count to six, do simple math, name shapes and colors, even help other students learn to speak. But the real surprise came when he heard music. Even though he’d never learned how, Alex began to dance.

Here’s the thing: Alex was a bird.

Although the African Grey parrot was already famous for his intelligence and linguistic abilities, there had been no signs of any musical talent. That changed in 2007, when Adena Schachner, a Harvard University PhD student who researches the origins of musical behavior, played Alex a song she’d composed.

“We were completely shocked to see that spontaneously, of his own accord, the parrot started to, it looked like, move to the beat,” Schachner said. Other researchers had told her that auditory entrainment — that is, listening to an external rhythm and moving the body in time with it — was a uniquely human skill. But mathematical analysis of Alex’s head bobs revealed that he was legitimately in sync with the music. So much for unique.

For humans, musical rhythm is universal and ingrained. Dance is found in every culture on Earth. Until recently, however, the evolutionary origins of our rhythmic ability had largely gone unprobed. Now, scientists like Schachner are looking to examples of rhythm in animals for insight into how we got the beat.

The first logical place to look for musical behavior like our own is in other primates. Chimpanzees, our closest evolutionary cousins, drum on logs and tree roots with their hands to display social dominance. Gorillas famously beat on their chests. And macaque monkeys, whose last common ancestor with humans lived 30 million years ago, shake branches in the wild — or cage bars when they’re captive — to tell other monkeys who’s boss.

Recent research demonstrates that for primates, like for us, rhythm and social communication are closely linked. Macaques process drum sounds in the same brain regions as vocal calls, according to a study published last October in the journal Proceedings of the National Academy of Sciences. Co-author Cristoph Kayser, who studies how the brain processes auditory information at the Max Planck Institute for Biological Cybernetics in Tübingen, Germany, explained that the corresponding brain regions in humans are specialized to analyze a speaker’s emotional state. In other words, just as we may hear sadness or anger in a piece of music, a macaque can sense excitement or agitation in a fellow macaques’ drum beats.

But primates’ musical abilities end there. Although apes and monkeys can hammer out a rhythm, they can’t entrain to an external one. Attempts to teach them how have failed, according to Anniruddh Patel, who studies music and the brain at the Neurosciences Institute in San Diego, Calif. That’s why it was such a surprise that an animal less closely related to humans, like Alex the parrot, could move on beat.

Alex died unexpectedly before Schachner’s research on him could continue, but he wasn’t the only dancing bird. Patel also works with Snowball, a sulfur-crested cockatoo whose proclivity for bopping to the Backstreet Boys made him a YouTube sensation. When he saw a video of Snowball swinging his head and stomping his legs to music, Patel remembers thinking: “Holy cow, this looks like it might be real.”

To determine if Snowball was truly entraining or merely hitting the beat by coincidence, Patel played the bird sped-up versions of the Backstreet Boys song. Sure enough, the faster the song played, the faster Snowball rocked out. That meant he could both recognize the rhythm and finely adjust his muscle movements to match it, which is the same thing we do when we dance.

“It suggests that you don’t need a human nervous system to have this behavior,” said Patel. He co-authored a paper on Snowball that appeared alongside Schachner’s study on Alex in Current Biology last May.

Schachner’s team also cast a wider net across the animal kingdom by searching YouTube for dancing pet videos. If something looked like entrainment, they analyzed it frame-by-frame to determine if the animal was truly on tempo. They found evidence of genuine entrainment in 14 bird species — including parrots, macaws and cockatoos — and in African elephants.

Our last common ancestor with elephants lived tens of millions of years ago, and birds’ evolutionary line split off long before that. So why do birds and elephants share something with us that our closer primate relatives don’t?

The link, Patel and Schachner believe, is vocal mimicry. Each of the species that can entrain to music has also evolved the ability to imitate external sound. Birds like parrots can imitate other bird calls and human speech. Elephants can reproduce the sounds of other elephants — and even, in one recently recorded case, the sound of trucks passing on a highway.

“The theory is that part of the machinery that’s necessary for keeping a beat originally evolved for vocal imitation,” Schachner said. That means that dancing may not be a beneficial adaptation itself, but rather a lucky side effect of one.

Or, as Patel put it, “It may be something that comes along for the ride when you have a certain kind of brain.”

The kind of brain you need seems be a social one. As he continues his research with Snowball, Patel is finding that the bird’s motivation to dance increases when there’s a person around. That neatly mirrors a recent study with human infants, which demonstrated that they can drum on a beat more accurately when they’re drumming with a human partner, rather than with a drumming robot or a sound alone. The work was published this past November in the Journal of Experimental Child Psychology.

The study’s lead author, Sebastian Kirschner of the Max Planck Institute for Evolutionary Anthropology in Leipzig, Germany, says the research suggests an innate social motivation to synchronize, which may turn out to be “typically human, but not uniquely human.”

Harvard’s Schachner is now focusing her research on beat-keeping in humans — she wants to see if moving in synchrony helps people cooperate better. Ultimately, she hopes the work will clarify the origins of our ability to socialize, and perhaps of music itself.

“It’s a phenomenon that’s so important to so many people,” Schachner said, “and we have no idea how it got there.”

By Mara Grunbaum