Want to write a hit song? Here are some tips

For every song that makes it into the pop charts, there are dozens more that flop. Now, scientists say they’ve figured out what separates a hit from a miss.

Researchers analyzed half a million songs released in the United Kingdom between 1985 and 2015 from a database called AcousticBrainz. The AcousticBrainz project uses software to extract the basic properties of songs, such as rhythm and frequencies. Higher-level characteristics are then provided by machine learning techniques, which have been trained by experts to infer acoustic features (e.g. danceability, timbre) and mood (e.g. happy, relaxed) of the music from its basic properties. The researchers looked at how these features have changed over time—and whether they are markedly different for songs that made the U.K. top 100 singles chart.

Over the past 3 decades, songs have become less happy and have a less bright timbre, the team found, but are also more danceable with a more relaxed mood. But there were also clear differences between charting and noncharting songs. Among other characteristics, songs that made the charts tended to be happier, more partylike, and more danceable, the authors report today in Royal Society Open Science .

Taylor Swift’s “Shake it Off,” for example, had a particularly high danceability rating and made it into the charts in 2014. On the other hand, “Cristina,” by Desperate Journalist, scored low on danceability—and didn’t end up charting.

By training models on music from recent years, the team could even predict which new songs were likely to chart with about 74% accuracy. So if you’re a singer looking to write the next big hit, embracing the musical features of top charting songs could maximize your chance of making it into pop stardom.