Like a vast number of urban teenagers, Linkin Park was one of my favorite rock bands during my high school years. The moods and emotions that their music captures resonate with all kinds of different age groups, so you may have discovered their music later on in your life.

Linkin Park's music has progressed a lot of over the years, from the radio-friendly nu-metal days of Hybrid Theory and Meteora to the alternative rock of Minutes to Midnight, experiments with electronic music on A Thousand Suns, and returning to a heavier rock sound in The Hunting Party. One More Light, their latest album, contains pop elements as well.

PHOTO CREDIT : By Javatyk [CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)],
from Wikimedia Commons

In this post, we'll try to capture the progression in their style through data analysis on their songs, using Python and Pandas. If you're not a programmer, you can still get a closer understanding of one of your favorite artists by steering clear of the code and focussing on the graphs and insights. All you need is basic knowledge of what a mean and standard deviation is, and the ability to read a histogram.

The code for this blog post is available on this Github repository

# Dataset¶

The data I'm using is provided by Spotify's awesome web API. Here is the script I used to get all the data. I'm using a python wrapper for the API, called Spotipy (There could't have been a better name for it), which provides metadata for all of their songs, as well as aggregated audio features like Energy, loudness, and Valence (I will be explaining these features down below).

Let's start by loading our data into a pandas dataframe and seeing what features we have.

In [18]:
data = pickle.load(open('lp-data.p', 'rb'))
print data.shape
print data.columns

(85, 6)
Index([u'name', u'album', u'energy', u'loudness', u'valence', u'duration'], dtype='object')


We have data for 85 songs from LP's 7 studio albums. For each song, the song name and album are available, along with the following audio features:

• Energy - a number between 0 and 1 which is a perceptual measure of intensity and activity
• Duration - Duration of the track, in minutes
• Loudness - Average loudness of the track in decibels
• Valence - A measure from 0.0 to 1.0 describing the musical positiveness conveyed by the track.

The Spotify API provides a number of additional features for songs - like acousticness, tempo, danceability, instrumentalness and time signature. Check out their docs to find out more about this.

# Introductory Analysis¶

In this section, we'll look at the album and song lengths. By album length, I mean the number of songs in the album.

Firstly, what were the actual albums? Pandas' "unique" function can help us with this.

In [4]:
print data['album'].unique()

['Onemorelight' 'Huntingparty' 'Livingthings' 'Thousandsuns' 'Minutes'
'Meteora' 'Hybrid']


How many songs were there in each of these albums?

In [4]:
data.groupby(by='album')['album'].count()

Out[4]:
album
Hybrid          12
Meteora         12
Minutes         12
Thousandsuns    15
Livingthings    12
Huntingparty    12
Onemorelight    10
Name: album, dtype: int64

LP mostly stuck to 12 songs an album routine, and shifted things a little in "A Thousand Suns" and "One More Light", with 15 and 10 songs respectively.

Ok, that was a bit too simple. You already knew about this. Let's look at the average song durations for each album. It will also help to look at the standard deviation of song lengths in each album (to see how song lengths varied within the albums).

In [36]:
plt.subplot(1, 2, 1)
data.groupby(by='album')['duration'].mean().plot(kind='bar');
plt.subplot(1, 2, 2)
data.groupby(by='album')['duration'].std().plot(kind='bar');


Most of the albums have mean song durations in the 3-3.5 minute range. On looking at the standard deviations though, we find that song lengths didn't vary much in the first two albums, while there was a switch in "Minutes to Midnight". You may have noticed this, too: the first two albums seemed very formulaic (at least in terms of song lengths), with similar length songs. "Minutes to Midnight" had some songs which broke the 3-minute barrier which LP had till then - Shadow of the Day was at around 5 minutes, and the album closer, The Little Things Give You Away, at 6.4 minutes.

A Thousand Suns was LP's most "varied" album (makes sense, because as far as I know, its their only concept album. In fact, Christopher Weingarten of The Village Voice compared it to Radiohead's OK Computer), with short songs like "The Radiance" and "Empty Spaces" and longer ones like "The Catalyst". LP lowered down the variance in "Living Things" and then bumped it up again in "Hunting Party" (which, although returned a bit to the heavier rock style of the first two albums, did not return to their original style of less variant song durations). One more light was, a big stylistic switch in terms of being more "poppy" in nature, and this reflected in small variation in length of the songs. In this sense, it was similar to the first two albums.

# Audio Features¶

There are 3 audio features that we'll be analyzing - Energy, Loudness, and Valence. As mentioned earlier, Energy is a measure of the intensity and activity of a song. According to Spotify's API documentation:

Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale.

Loudness is a pretty-self explanatory feature. Valence represents the musical positiveness of the track. Again, from the docs:

Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry).

You might have some vague idea about the switch in style of LP's albums - the first two (Hybrid Theory and Meteora) were energetic and heavy, Minutes to Midnight toned down a bit on the heaviness, and so on. Let us try to understand the switch objectively in terms of these 3 parameters.

## Energy¶

Just like we did with song durations, we'll look at the mean and standard deviation of the energy of songs for each album

In [38]:
plt.subplot(1, 2, 1)
data.groupby(by='album')['energy'].mean().plot(kind='bar');
plt.subplot(1, 2, 2)
data.groupby(by='album')['energy'].std().plot(kind='bar');


As we can see, the first 2 albums, on average, were high energy (~0.9) with little variation throughout the albums. The energy toned down in the next two albums, while at the same time the variation in energy amongst songs increased, quite a bit. Then, the mean energy picked up again in "Living Things" and "Hunting Party" (which were as energetic as the first two albums). "One more light" again toned down on the energy.

We'll group the albums to make it easier to analyze them. Hybrid Theory and Meteora into one group, the next two albums, Minutes to Midnight and A Thousand Suns into another, Living Things and Hunting Party into another, and finally, One More Light.

Following is the distribution of the "energy" of songs for the first two pairs of albums.

In [25]:
plt.subplot(1, 2, 1)
data[data.album.isin(['Hybrid', 'Meteora'])].energy.plot.hist(bins=10, ylim=[0,20], range=(0,1));
plt.subplot(1, 2, 2)
data[data.album.isin(['Minutes', 'Thousandsuns'])].energy.plot.hist(bins=10, range=(0,1), ylim=[0,20]);


As discussed above, most songs are in the first two albums are in the high energy (0.8-1.0) range, with little variation. The lowest energy song is Crawling at around 0.7. In the next two albums, there is a huge shift in the energy of songs - a lot of them lie in the mid-energy range, and quite a few in low energy as well. Shadow of the day, at 0.37, was their first "really slow song". "A Thousand Suns" was more energetic on an average than Minutes, but had a similar level of variation.

In [24]:
plt.subplot(1, 2, 1)
data[data.album.isin(['Huntingparty', 'Livingthings'])].energy.plot.hist(bins=10, range=(0,1), ylim=[0,20]);
plt.subplot(1, 2, 2)
data[data.album.isin(['Onemorelight'])].energy.plot.hist(bins=10, range=(0,1), ylim=[0,10]);


"Living Things" and "Hunting Party", from a purely energy perspective, were similar to the first two albums. "Hunting Party", which was supposed to be a return to their heavy rock roots, was on an average almost as energetic as "Meteora", albeit with more variation. Since the final group contains 1 album (unlike 2 albums in other groups), I have reduced the y-range from 20 to 10. Unsurprisingly, this was the least energetic album.

## Loudness¶

In [39]:
plt.subplot(1, 2, 1)
data.groupby(by='album')['loudness'].mean().plot(kind='bar');
plt.subplot(1, 2, 2)
data.groupby(by='album')['loudness'].std().plot(kind='bar');


Mean Loudness of LP's albums follows a similar trend to Energy. For reference, 10 Decibels increase in loudness is equivalent to 2 times the perceived level of loudness. "Meteora", on average being the loudest album, at -8.7 dB, is perceived to be 1.4 times as loud as the least loud album: "A Thousand Suns". You can use this calculator to understand the relationship between decibels and perceived loudness.

Back to looking at the groups of albums like we did for Energy:

In [23]:
plt.subplot(1, 2, 1)
data[data.album.isin(['Hybrid', 'Meteora'])].loudness.plot.hist(bins=10, ylim=[0,10], range=(-8,-2));
plt.subplot(1, 2, 2)
data[data.album.isin(['Minutes', 'Thousandsuns'])].loudness.plot.hist(bins=10, range=(-8,-2), ylim=[0,10]);


I'm sure you can recall that the first 2 albums were full of banging loud songs. The loudest from Meteora was From the Inside, at -2.6 dB and from Hybrid Theory was Forgotten at -3.8db. Meteora, on average, was significantly louder than Hybrid Theory. The histogram of loudness for the next two albums shifts to the left, going with the general theme shift that LP was trying, of being more subtle with the intensity, and going with more depth in their songs. The loudest song from these 2 albums is Blackout from Thousand Suns, at -4 dB. Overall, Minutes is louder than Thousand Suns, and both have higher variation in loudness than the first 2 albums.

In [22]:
plt.subplot(1, 2, 1)
data[data.album.isin(['Huntingparty', 'Livingthings'])].loudness.plot.hist(bins=10, range=(-8,-2), ylim=[0,10]);
plt.subplot(1, 2, 2)
data[data.album.isin(['Onemorelight'])].loudness.plot.hist(bins=10, range=(-8,-2), ylim=[0,5]);


After decreasing the general loudness in the previous 2 albums, the histogram again shifts to the right in the next two. "Hunting Party", on average, is almost as loud as "Hybrid Theory". Again, the general theme in these 2 albums seems to shift back to their roots in terms of the energy and heaviness, but maintain the increase in variation that they did on the third and fourth album**. "One more Light", one would expect, being the most "poppiest" album, would also be the least loud. But it turns out that its louder on average than both Minutes to Midnight and A Thousand Suns. This could be due to the fact that there are lesser "soft" or low loudness songs on this album.

## Valence¶

LP has always been a "dark" band, dealing with negative issues. But how does this vary across their albums? Are some less negative than others? We can get more insights into this by looking at the "valence" feature in our dataset, which represents the musical positiveness of the track. Following is the mean and standard deviation of valence across the albums.

In [40]:
plt.subplot(1, 2, 1)
data.groupby(by='album')['valence'].mean().plot(kind='bar');
plt.subplot(1, 2, 2)
data.groupby(by='album')['valence'].std().plot(kind='bar');


Overall, "Meteora" was more valiant (positive) than "Hybrid Theory". This could indicate that the subject themes of Meteora, though still angsty, had some sort of resolution compared to the uncertainty and confusion that the protagonist of "Hybrid Theory" might have felt. The most valiant song from "Meteora" - Don't stay (0.68) represent some sort of positivity. It's about the protagonist finally realizing that although the relationship started out well, it has ended up at a phase where it's totally destroying him and that he needs to be alone to figure out what is right for him. The least valiant non-instrumental songs from these two albums are Easier to Run and Pushing me away, at 0.28.

A Thousand Suns seems to be the least "positive" album. Though the first two albums dealt with angsty adolescent issues, represented in the form of high energy, intensity, and loudness, the next two albums seemed to go more into depth in those issues, at the expense of energy and loudness. Overall, Minutes is their most varied album in terms of valence.

### Conclusion¶

Here, we'll try to summarize the progression in the style of Linkin Park's albums. Hybrid Theory and Meteora consisted of loud, intense songs with a dark subject matter, but with little variation in depth, in song lengths, intensity, and meaning. They were the perfect albums to get started with listening to Linkin Park - simple and in-your-face. In Minutes to Midnight and A Thousand Suns, LP experimented with various styles, as well as song durations, loudness, and intensity. They tried to dig deeper within themselves, and as a result, added more depth to their songs, at the expense of overall loudness and energy.

Having experimented a lot, LP was ready to go back to their original style, but in a modified way in the next two albums - Living Things And Hunting Party. Here, they reduced the variation a little from the previous two albums, while trying to relive the energy and loudness of the first two albums. They became comfortable with who they were. I think these two were probably the easiest albums for them to make. One More Light has got me a little stumped - it's difficult to categorize it or group it with the other LP albums. It just seems an "average" of all the other albums in terms of Energy, Loudness, Valence, and variation of these features. It makes sense - since they were changing their genre a lot in this album, they probably decided to not experiment too much with the other elements that make their style.

To conclude, let's look at some interesting stats based on our analysis of LP's songs:

• Softest song: Fallout from A Thousand Suns
• Loudest song: From The Inside from Meteora
• Least energetic song: Fallout from A Thousand Suns
• Most energetic song: Don't Stay from Meteora
• "Happiest" song: Given Up from Minutes to Midnight (a bit ironic, this one)
• "Saddest" song: The Requiem from A Thousand Suns

In the next blog post, we will continue our analysis of LP's changing style of music over the years, by analyzing the progression in mood of their songs. Gracenote developer API provides us with a labeling of "mood" for each song. We'll be using a set of 9 moods, including Peaceful, Sensual, Aggressive and Excited, and try to relate how the attributes we have studied in this post (Energy, Loudness and Valence) affect the mood of a song.

Thanks for reading. Do let me know what you thought of this post, in the comments below. Would love to know how your experience of listening to LP matches with this analysis.

Go Top