Algorithmically generated playlists on music streaming services like Spotify make a best guess at what kind of music you'll enjoy based on what you and others like you listen to and like. A new study reveals how those playlists could be better based on how your brain rocks out to the latest songs.

When US researchers trained machine learning algorithms to analyze music listeners' bodily responses, they could predict which tracks would please the most people with 97 percent accuracy.

All the algorithms had to do was gauge a person's emotion and attention to a tune, using the state of their neurophysiology as a proxy.

The longer a person was neurologically 'immersed' in a song and the less they were 'in retreat', the more likely the song would be a national hit.

In fact, this was a much better indicator of a tune's success than whether an individual said they enjoyed listening to the song.

In other words, just because you consciously enjoy a track doesn't mean other people will. Your subconscious state, however, might know better.

"Rather than asking users if they 'like' a new song, wearable neural technologies, like those in this study, could assess the neural value of content automatically," the researchers write.

Even if the algorithm was fed physiological data from just a minute of listening to a song, it could still predict a hit with 82 percent accuracy.

The new method outperforms similar studies that used brain scans to assess musical responses. These were only able to predict hits at a rate of about 50 percent.

In the new experiments, individual listeners were only good at guessing if a song was successful if they'd already heard it before – a bias that, when removed, makes us much worse at predicting a hit or flop.

"By applying machine learning to neurophysiologic data, we could almost perfectly identify hit songs," says neuroeconomist Paul Zak from Claremont Graduate University in California.

"That the neural activity of 33 people can predict if millions of others listened to new songs is quite amazing. Nothing close to this accuracy has ever been shown before."

Participants in the study first sat in a room wearing cardiac sensors and listened to 24 recent songs played over loudspeakers. Thirteen songs were deemed hits by streaming platforms, but participants weren't informed which ones these were.

At the end of the experiment, the group was asked to rank which songs they liked best.

The data collected from their cardiac sensors were then fed into a commercial neuroscience platform that uses heart rate data to infer the state of a person's brain.

Oxytocin and dopamine, for instance, are two neurological hormones known to have downstream effects on the heart. They are also released when you feel good.

As you sing or listen to music, for instance, evidence suggests your brainstem often releases oxytocin, and dopamine is released and binds to the prefrontal cortex when you are paying extra attention to something, or you're 'immersed' in it.

Reading these brain signals via the heart could be a way to 'neuroforecast' which songs will get more people's feet tapping.

Previous studies have tried to do this by focusing on one brain region involved in the reward system. But researchers had little success.

The current study focuses on different neurophysiological signals that, importantly, incorporate emotional responses. It also used an ensemble of machine learning algorithms, not just one.

"Measuring emotional responses using neuroscience technologies provides a new way for artists, record producers, and streaming services to delight listeners with new music," the authors write.

"Our contribution is to show that omnibus neuroscience measurements from the peripheral nervous system quite accurately classify hits and flops."

Theoretically, This information could be used to create individual playlists for certain mood states, but it applies to more than just music.

'Neuroforecasting' could also be applied to just about any form of entertainment, giving people what they want before they even know it.

The current study is small, and some details still need to be worked out, but as a proof of concept, it seems hopeful.

"Our key contribution is the methodology," says Zak.

"It is likely that this approach can be used to predict hits for many other kinds of entertainment too, including movies and TV shows."

The study was published in Frontiers in Artificial Intelligence.