The story behind this project has a sad beginning. I remember being at a networking event in Eindhoven (The Netherlands) on April 20, 2018. A colleague walked up to me and said: “Avicii has died”. Having just watched the documentary True Stories, which ended on quite a positive note, the news hit me right in the heart.

At first, I could not believe it. A bit later I felt that this was the first time for me that an artist had died, and I truly felt it. A personal legend had died. And not long after the news initially broke, it became known that Avicii had committed suicide…

Analysing the Lyrics of Avicii’s music

I’m a data analyst by profession. About a week after his death, I decided to see if could use my professional skills to see a development in his music.

I ended up applying a sentiment analysis to Avicii’s lyrics using Google’s Natural Language API. Sentiment analysis turns the lyrics of each song into a data point. Each data point contains the sentiment score, ranging from -1.0 to +1.0. It tells us if the lyrics are mostly negative or positive. It also includes a value for the magnitude that tells us how strongly the emotion is represented. 

Here’s an example of Avicii’s song You Make Me:

{
  index: 2,
  title: 'you make me',
  album: 'true',
  sentiment: 0.3,
  magnitude: 6.5,
}

After converting each song into a data point, it was time to visualise the results.

Visualising Avicii’s Music

I visualised the results using scatter plots. These plots show a dot per song. The position of the song is determined by the data values. The x-axis is set to the sentiment scores and the y-axis is set to the magnitude. The magnitude value also increases the size of the dot.

This approach gave the following results of his first three releases (True, Stories, and Avici(01)):

avicii dataviz sentiment true

Sentiment analysis of Avicii’s True.

avicii dataviz sentiment stories

Sentiment analysis of Avicii’s Stories.

avicii dataviz sentiment avici01

Sentiment analysis of Avicii’s Avici(01).

I discussed the results with friends and colleagues.

The result? Most people said that first, music is more than just the lyrics, and second, that if you listen to the lyrics, anyone can interpret them in a different way. And to be honest: I agree.

A new direction for the project

I dropped the initial idea of finding a new meaning in his songs. But what I did really like was the way the results looked. Especially when I listed all the songs in a single plot:

avicii dataviz sentiment discography may 2018

Sentiment analysis of Avicii’s True, Stories, and Avici(01).

And so I chose a new development direction, a creative one, one that focused on the visual representation. And most importantly: it felt like the right direction to go in.

Instead of using colours based on sentiment score, I coloured the dots by album. I used a grey for True, a pink for Stories, and a yellow for Avici(01):

avicii dataviz sentiment discography album colors

Sentiment analysis of Avicii with album colours.

I liked this visual so much, I decided to have it printed on a t-shirt:

avicii dataviz sentiment discography t-shirt

Me being happy with my first Avicii t-shirt.

I was really happy with the result. And proud that I used my data analysis skill to create a t-shirt of one of my personal heroes.

Finding magic in TIM, the posthumous album

On June 6 2019, Avicii’s posthumous album TIM was released. I felt like doing something new with this album. I started out with the initial analysis of sentiment:

avicii dataviz sentiment tim

Sentiment analysis of Avicii’s TIM.

After that, I took things in a new direction. Instead of applying album colours to the dots, I wrote a program that connected all the dots. The program draws a line from dot to dot, starting with the first song on the album and ending with the last one. I started with a straight line, but I found the results a bit edgy. Because of that, I tweaked to program to draw a curved line instead.

Here’s an animation of the drawing process:

avicii dataviz sentiment tim line animation

Animated GIF of the program drawing a line between dots.

Here’s a static image of the result:

avicii dataviz sentiment tim line

Static organic line visual of Avicii’s TIM.

Now that is what I call a beautiful line. To me, it mimics a handwritten signature. And you don’t need that much imagination to even see a T in it (if you don’t know: Avicii’s real name is Tim Bergling). That’s what made this result magical to me.

I liked this abstract line even more than the dots of my initial analysis. And of course, I had this one printed on a t-shirt as well:

avicii dataviz sentiment tim t-shirt

Me being happy with my second Avicii t-shirt.

Thank you Avicii, for your music, and for being an amazing source of inspiration.


Other T-Shirts

After completing this project, I’ve used the same technology to create more t-shirts. You can find the links to related stories here:

If you would like to wear one of t-shirts, visit the dataviz t-shirts page.


Technical Note

This project was built using the following technologies:

  • Python: the Google Natural Language API for the text analysis, Pandas for data processing, and Matplotlib for data visualisation.
  • Inkscape for preparing the final image from Python for print.

Visit my GitHub repository to view the project code and try it yourself.