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. A few weeks later I started wondering what would happen if I’d use my skills as a data analyst to find new meaning in his music. I’ve been slowly but steadily working on this project since.
On this page, you’ll find the latest status of the project. Further down, you can find links to some stories of developments in this project that I’ve published throughout the years.
Analysing the Lyrics of Avicii’s music
I ended up applying a sentiment analysis to Avicii’s lyrics using Google’s Natural Language API (in normal-speak: 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 Heaven from the album TIM:
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 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. Looking at Avicii’s posthumous album TIM, I get the following results:
When sharing my project with friends and family and at events, I generally get questions about the true meaning of this. And I get that. Music a personal thing. Lyrics alone can be interpreted in numerous ways. And sounds can play a huge if not defining role. Having an algorithm ‘score’ lyrics doesn’t always match how we, as people, experience a song. So somewhere in the process, I moved my focus away from true ‘meaningful’ data analysis and visualisation.
My renewed focus was a creative one.
Visualising a machine’s view on music lyrics
So at this time, I took things in a new direction. Instead of applying album colours to the dots, I simplified them. The result is a sort of connect-the-dots drawing:
Next, I write a program that connects 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. The first version I made had a straight line, but I found the results a bit edgy:
Because of the edginess, I tweaked to program to draw a curved line instead. Technically the curves are generated by applying a so-called Bézier curve, originally designed for car modelling. 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 of the music album. 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:
Here’s a cleaned up image of the result:
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 a lot and it printed on a 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.
I’m setting up a course around my project. For more info, visit this page.
After completing this project, I’ve used the same technology to create more visualisations and t-shirts. I tend to get back to a project whenever I have a special music experience. You can find the links to related stories here:
- Avicii – True, Stories, and Avici 01 (origin story part 1)
- Avicii – TIM (origin story part 2)
- Madeon – Good Faith
- Dagny – Ultraviolet (diamonds!)
- Daft Punk – Something About Us
- Chainsmokers – World War Joy (embroidered dataviz sweater!).
- Gorillaz – Gorillaz
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.
The complete project is free to use. Visit my GitHub repository to view the project code and try it yourself.