Listening to music is a powerful way to regulate emotions. Now scientists hope to capture this mathematically to help us find the perfect track to suit our mood (Photo: Shutterstock)

Mathematician will regulate your emotions with music

A mathematical model will help users of online music services to find the music that best suits their mood.

‘Happy' by Pharrel Williams certainly lives up to its name, whilst Adele is just the ticket when you need a good cry following a painful break up.

Whatever your taste, music expresses a range of emotions that are not always obvious. Now, Jens Madsen from the Danish Technical University (DTU) is developing mathematical formulae to help music services to tap into these emotions and find the perfect music to suit your mood.

"People want to regulate their emotions with music. Perhaps you use music to cheer yourself up when you are sad, or to get into a festive mood. This is the starting point for my work," says Madsen, a postdoc at DTU Compute.

We use music to control our emotions

Madsen started the project because he was not satisfied with the music streaming services available.

"The major music services like Spotify and Apple Music have access to 30 to 40 million tracks that you can only find by searching the titles or artists, or perhaps by pressing 'similar artists'. But if the goal of listening to music is to feel happy, then these services can’t find the right music," says Madsen.

Madsen needed to know what makes people listen to certain types of music. He started with the psychology that lies behind our choices and found that emotions were the biggest influence.

Niels Christian Hansen, a PhD student at the Centre for Music in the Brain at Aarhus University and the Royal Academy of Music, Denmark, agrees.

"It sounds like an excellent idea, and it’ll be of great interest in the future. There’s many ways to use music, and one of them is to regulate mood," says Hansen.

Individual emotional reaction to music

The algorithm, which Madsen is working on, analyses the songs and calculates the order of tonal changes, how the rhythm of the music progresses, and whether a song is played in a major or a minor key--all the things that dictate how a piece of music sounds to our ears.

But the real advance is that it also takes into account the feelings that the music expresses, says Madsen.

"We actually don’t know much about the underlying mechanisms behind how music changes our feelings. It’s partly to do with how the music sounds. But some feelings are also due to our personal memories about a piece of music," he says.

For this reason, Madsen will initially focus on classifying the feelings that listeners believe the music expresses, rather than the emotions it arouses.

Ultimately, he envisions a 'no stress' or a 'make me happy' button embedded in online music services. But more work is needed before reaching that goal.

Used by Spotify and health professionals

So far, Madsen has built a mathematical model, but it does not yet contain all the types of music and user data needed for him to achieve his vision.

"The goal is to use the algorithm in music services, but you could also imagine that we could use it in other situations, such as in medicine. Music can be used in the health sector, and maybe our algorithm can also be used in this field," says Madsen.

But is it possible to analyse music mathematically in this way? Yes, says Hansen, but it will never be perfect.

"We live in a technical age where we try to use mathematics to understand everything. This also applies to music. I conduct experiments in which I try to understand how people understand music, and it seems that we are totally dependent on mathematics," says Hansen.

"But music is of course very individual, and therefore he [Madsen] will be able to create a program that can provide some general pictures of mood, but it probably won’t work for everyone," he says.

In his opinion, there will always be something extra that mathematics cannot capture, says Hansen. “There will always be that little piece of magic.”


Read the Danish version of this story on

Translated by: Catherine Jex

Scientific links

External links

Related content
Powered by Labrador CMS