A surprising number of us can sing with perfect pitch, according to a new study that analyzed the karaoke skills of 30 people – as long as we're singing one of our 'earworms', those songs that get stuck in our heads.

Breaking down the stats from the team at the University of California, Santa Cruz (UC Santa Cruz), 44.7 percent of the recordings had a zero pitch error margin, while 68.9 percent were accurate within one semitone of the original tune (that's the smallest of musical intervals, for the non-musicians).

Perfect pitch – being able to hit a note with full accuracy on the first try without any reference – is thought to describe fewer than 1 in 10,000 individuals.

That statistic might not take into account people singing a song they're intimately familiar with, however.

"What this shows is that a surprisingly large portion of the population has a type of automatic, hidden perfect pitch ability," says cognitive psychologist Matt Evans from UC Santa Cruz.

"As it turns out, many people with very strong pitch memory may not have very good judgment of their own accuracy, and that may be because they don't have the labeling ability that comes with true perfect pitch."

Keen to analyze how memory and music interact, the researchers took earworms into account as an involuntary form of recall. To our frequent frustration, they're usually not recollections we purposefully summon at will.

The participants were encouraged to make recordings on their phone whenever and wherever songs popped into their heads for a total of two weeks. None of the group were professional musicians or thought they had perfect pitch, but the recordings suggested otherwise.

That's another area the researchers are hoping to look at more closely in the future: how well we can judge our own singing ability and indeed our own powers of recall, and how the brain might be wired to offer some help.

"Interestingly, if you were to ask people how they thought they did in this task, they would probably be pretty confident that they had the melody right, but they would be much less certain that they were singing in the right key," says Evans.

The findings also offer clues as to how musical memories might differ from other memories. It seems the brain keeps earworms fully intact inside our minds, right down to the correct pitch, rather than taking any shortcuts.

Besides the science of memory and music, the research suggests your singing voice might be better than you thought it was – and that there's more innate musical ability locked inside our brains than previously believed.

"Music and singing are uniquely human experiences that so many people don't allow themselves to engage with because they don't think they can, or they've been told they can't," says Evans.

"But in reality, you don't have to be Beyonce to have what it takes to make music. Your brain is already doing some of it automatically and accurately, despite that part of you that thinks you can't."

The research has been published in Attention, Perception, & Psychophysics.