Earlier this year, I shared a personal project. With the project, I showed how I used a service by Google (the Google Cloud Natural Language API) to analyse the emotion (or sentiment) in music lyrics. In this post, I use the same technology to visualise his posthumous album TIM.

If you haven’t read about my previous analysis of Avicii’s songs, you can read it here.

The sentiment

I started out with a visual of the sentiment of his songs; using red for negative songs, grey for neutral songs, and green for positive songs. This resulted in the following overview of the album:

One of the upgrades I’ve made recently is a version of the plot that adds the song title to each dot. It makes it easy to find a song in the plot.  Here’s what it looks like:

According to the analysis, the album has 6 negative songs, 1 neutral (which is interestingly called bad reputation), and 5 positive songs. Keep in mind that this  result is based on a machine learning algorithm analysing the lyrics of each song.

After completing the initial visualisation, I got rid of all the sentiment-related colours (reds, greys, and greens) and applied a colour from the album cover. In this case, I chose a skintone from the picture of Tim himself:

To me, the result is once more an interesting and abstract visual of a full album.

Making it more abstract

Even though I’m quite pleased with the scatter plot design of my visuals, I have been working on something new. Let me explain to you what it is.

First, we will have another look at the visual. This time, I add a label to each song with the index, so you know what index they represent on the album:

After that, I draw a line from song to song based on the index:

Here is where it gets interesting. Python (the programming language I use for this project) has a data visualisation solution (the Matplotlib package) that allows me to create the dot visual (a scatter plot), and draw lines from one point to another (as you see in the image above). The cool thing is that you can curve the line based on the values of each dot.

Here’s the graph you saw before, with the curved lines added in black:

The line starts at the open end on the right. It ends at the open end on the left.

What I don’t really get is why it moves up at the end (as you can see, the black end on the left is way off compared to the end of the red line on the left). To be honest, I’ve tried to correct that, but could not figure it out. And currently I see a kind of the beauty in the little ‘issue’: it’s an organic line that represents a machine’s interpretation of music, and I don’t really get how it draws some parts of it. Why would I need to understand a machine’s interpretation of music if I sometimes don’t even understand my own?

When I remove the red lines, you will get a better view of how beautiful the organic line actually is:

To me, seeing an album represented in such an organic looking line is magical. It looks like a hand-written signature of the album. And the most amazing part: it is all generated by code.

A new t-shirt

I like wearing the stuff I generate, so I again prepared the new visual for print. Just as with the dots, I opted for a skin tone of Tim on the album cover. I went with a dark grey t-shirt so both colours are based on the album cover. Sadly, the t-shirt is not in yet as I am writing this post. So no image of me wearing the t-shirt just yet. But I do have an image render of the shop where I had it printed:

I have to say: I am (again) really happy with the result. I like how it looks like ‘a t-shirt with an abstract line’, even though that line represents the music of Avicii’s posthumous album.

A personal note

I haven’t spent as much time with his latest album as I have with his previous music. But I do have a favourite song. It is the 11th song on the album: Never Leave Me. According to the analysis it is positive (+0.3 on a scale from -1 to +1) and has a magnitude of 4. And I have to say, the song sounds like one big thankyou to some amazing lady. What strikes me is the end, and how the end of the song perfectly matches the lyrics:

She knows how I’m feeling
She banishes all my demons
So easy, like breathing
She bandages all my bleeding
She knows how I love her
We take it down undercover
She gets me, she sees me
I hope that she’ll never leave me

And right after the last line, I hope that she’ll never leave me, the song stops and leaves you.