The harsh bark of the seal certainly doesn't spring to mind when you're thinking of melodious singing voices in the animal kingdom. But it seems the puppies of the sea have been holding out on us: When it comes to replicating a tune, they're surprisingly talented.

While studying the vocal learning of grey seals (Halichoerus grypus), scientists taught them how to mimic human speech and even music, such as "Twinkle Twinkle Little Star" and the theme to the classic sci-fi franchise Star Wars.

"This study gives us a better understanding of the evolution of vocal learning, a skill that is crucial for human language development," explained biologist Vincent Janik of the Scottish Oceans Institute (SOI) at the University of St Andrews.

The researchers worked with three seals named Zola, Janice, and Gandalf. The animals were housed at the university's marine mammal facility with other seals, and carefully monitored from birth to build a catalogue of their natural vocal repertoire.

Then came the painstaking task of teaching them. First, the seals were trained to copy sequences of sounds from their own repertoires. Then they were trained to copy 'melodies' in their own vocalisations, a sustained call with changing pitch and varying number of repetitions.

Once they had an 80 percent accuracy rate at this task, the animals were progressed to learning new vocalisations - human-like vowel sounds - by changing formants, prominent frequency bands used in human speech through which information is conveyed.

"It takes hundreds of trials to teach the seal what we want it to do, but once they get the idea they can copy a new sound pretty well at the first attempt," Janik told New Scientist.

Ultimately, all three were able to copy short sequences of sounds, and Zola was able to repeat up to 10 notes of "Twinkle Twinkle Little Star".

Other seals, like the famous harbour seal Hoover, have been recorded mimicking human-like vocalisations, but until now, no one had set out to study precisely how the pinnipeds can "talk".

As it turns out, they use the same structures in the larynx to make human sounds as we humans do ourselves.

"I was amazed how well the seals copied the model sounds we played to them," said biologist Amanda Stansbury, formerly of the SOI and now at El Paso Zoo.

"Copies were not perfect, but given that these are not typical seal sounds it is pretty impressive. Our study really demonstrates how flexible seal vocalisations are. Previous studies just provided anecdotal evidence for this."

Other marine animals have also been taught to speak like a human, including orcas and a beluga whale, who could actually sing a really well-defined song.

But the fact that seals use the same supra-laryngeal structures as humans means that they could be a good way to study how humans speak, too.

"Surprisingly, nonhuman primates have very limited abilities in this domain," Janik said.

"Finding other mammals that use their vocal tract in the same way as us to modify sounds informs us on how vocal skills are influenced by genetics and learning and can ultimately help to develop new methods to study speech disorders."

The research has been published in Current Biology.