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 (a big machine that understands text). 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:
title: 'you make me',
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)):
Sentiment analysis of Avicii’s True.
Sentiment analysis of Avicii’s Stories.
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:
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):
Sentiment analysis of Avicii with album colours.
I liked this visual so much, I decided to have it printed on a 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:
Sentiment analysis of Avicii’s TIM.
Visualising a machine’s view on music lyrics
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.
A line connecting dots based on the song’s album index.
Because of the edginess, I tweaked to program to draw a curved line instead.
Applying Bézier Curves
Technically the curves are generated by applying a so-called Bézier curve. I won’t go into the details of such a curve, but the image below shows you how it works:
You see that the line starts at 1, is then pulled towards 2 and 3, before ending at 4.
I can apply the same method to my data points. This makes the line start at song 1, pull towards song 2 and 3, before ending at song 4. The next part starts at song 4, pulls towards song 5 and 6, and ends at song 7. You get the idea.
Generating a visual using Bézier curves instead of straight lines gives the following result:
Image of the Bézier curve visualisation.
Here’s a cleaned up image of the result:
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 see a T in it (if you don’t know: Avicii’s real name is Tim Bergling). This is all generated by a machine’s interpretation of his lyrics and some creative code to generate a visual. 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:
Me being happy with my second Avicii t-shirt.
Thank you Avicii, for your music, and for being an amazing source of inspiration.
After completing this project, I’ve used the same technology to create more t-shirts. You can find the links to related stories here:
- Madeon Good Faith dataviz t-shirt.
- Daft Punk Something About Us dataviz t-shirt.
- Chainsmokers World War Joy embroidered dataviz sweater.
- Gorillaz Gorillaz Dataviz t-shirt.
If you would like to wear one of t-shirts, visit the dataviz t-shirts page.
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.