Pop Tay Tay vs. Country Taylor Swift:

Song Features Analysis using Clustering Analysis Techniques of Pop and Country Songs (1990s and onwards)

Ayesha Mendoza
8 min readJan 10, 2019

It seems to be getting harder to distinguish a country song from a pop song with the songs we hear these days. Is there really a difference between the two? Are there song features which will be able to classify these two genres?

Take Taylor Swift’s songs. When I first heard her music when she was just starting out, I wouldn’t have known she was a country singer if I did not see her among other country singers in country music award shows, performing and receiving awards for country music.

For this analysis, pop and country songs from 1990’s and onwards will be analyzed to answer the following questions:

  • How does country and pop music differ?
  • Are there differences between the two music genres? Can we find some patterns that would differentiate these two music genres?
  • What patterns do we find with the song features?

A larger dataset of pop and country songs will be first analyzed, where we will be working with songs which have been tagged with the word ‘pop’ or ‘country’ from the Million Songs Database https://labrosa.ee.columbia.edu/millionsong/.

We will then see how these findings relate to Taylor Swift’s songs recorded as a country artist, and her songs after leaving country music and switching over to pop in 2014.

Song Feature Selection:

The following song features were extracted via the Spotify API:

Spotify Audio Features

  • acousticness: describes how many acoustic sounds the track has vs. how many electric sounds [0.0 to 1.0]
  • danceability: describes how suitable a track is for dancing based on a combination of musical elements. [0.0 least danceable to 1.0 most danceable)
  • duration_ms
  • energy: represents perceptual measure of intensity and activity. typically energetic feels fast, loud and noisy. [0.0 to 1.0]
  • instrumentalness
  • key
  • liveness
  • loudness
  • mode
  • speechiness
  • tempo
  • time signature
  • valence: measure from [0.0 to 1.0] describes the musical positiveness conveyed by a track. 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)

Spotify Audio Analysis:
The length and average/median values below were derived from the Spotify Audio Analysis values extracted.

  • bar length: a bar or measure is a segment of time as a given number of beats
  • beats length: The time interval of beats throughout the track. A beat is the basic time unit of a piece of music.
  • sections length: defined by large variation in rhythm or timbre e.g. chorus, verse, bridge, guitar solo etc.
  • segment length: each segment contains a roughly consistent sound throughout its duration
  • average & median pitch — values from 0 to 1 that describe the relative dominance of every pitch in the scale.
  • average & median timbre — timbre is the quality of musical note or sound that distinguishes different types of musical instruments or voices.

Six (6) features (those typed in bold above) will be used for this analysis.

The git repo/notebook will contain the data cleansing and the analysis done showing how we arrived with using just six (6) of the song features. The Jupyter notebook for this project can be accessed here.

Scatter Matrix for our six song features: danceability, energy, acousticness, valence, pitch, and timbre.

Clustering Analysis and Results:

The song features were processed through PCA for dimensionality reduction, to enable us to visualize in a 3D plot.

PCA components plotted in 3D, each group corresponds to each of the three cluster labels.
PCA components plotted in 3D, where each group corresponds to the music genre (country vs. pop)

Looking at the 3D plot above, colored by genre, we can already see a huge overlap of country songs and pop songs across our feature space!

Let us look deeper into the resulting cluster features to see how our KMeans clustering broke down our clusters:

Cluster characteristics for KMeans (k=3)

Based on the clusters that were generated, we can see that the main features differentiating each of the clusters are: acousticness, energy, danceability and valence.

Cluster 0: low acousticness, high energy, low valence
Cluster 1: low acousticness, high energy, high valence, high danceability
Cluster 2: high acousticness, low energy, low valence

Let us look at how our country and pop songs were labeled and distributed across the three clusters.

For Clusters 0 and 1, percentages of pop songs assigned to these clusters are slightly higher than the country songs. For cluster 2 country songs have a higher percentage than pop songs.
Distribution of Pop and Country songs by year range across all three (3) clusters. The graph shows that the year of the song does not affect how the songs were classified. Both country and pop songs are spread out across all clusters.

Let us see how the clusters would look like if we set the number of clusters to two (2), under the assumption that we have two classes of songs, one for each of the genres:

Cluster characteristics for KMeans (k=2)

The same features differentiate our two clusters where,

Cluster 0: low acousticness, high energy, high valence
Cluster 1: high acousticness, low energy, low valence

Let us look at how our country and pop songs were labeled and distributed across the two clusters.

More than 50% of both country and pop songs have been labeled as Cluster 0, although a larger percentage of pop songs were labeled as Cluster 0 (low acousticness) compared to country songs, while a larger percentage of country songs were labeled as Cluster 1 (high acousticness).
Distribution of Pop and Country songs by year range across the two clusters. The graph shows that the year of the song does not affect how the songs were classified. Both country and pop songs are spread out across all clusters.

Looking at how our songs were labeled by the KMeans clustering algorithm, we can see that we have both country and pop songs assigned in each of the different clusters. Our results show that the song features do not distinctly classify pop songs and country songs separately, but instead it shows that both pop and country songs share the same song features.

So what was the big deal with Taylor Swift leaving country music in 2014 ?
Can we see any major differences in the song features of Taylor Swift’s songs as a country artist, and her songs as a pop artist?

Processing Taylor Swift songs through our KMeans clustering algorithm, it produces clusters with similar attributes:

Cluster 0 — low acousticness, lower energy (than cluster 2), lower valence (than cluster 2)
Cluster 1 — high acousticness, low energy, low valence
Cluster 2 — low acousticness, high energy, high valence, high danceability

Cluster characteristics for clusters generated withTaylor Swift Songs processed using KMeans (k=3)

Looking at the clusters generated above, we can see that Clusters 0 and 2 are very similar, with Cluster 0’s values slightly lower than Cluster 2. Let us see how the clusters would look like if we just create two clusters:

Cluster characteristics for clusters generated with Taylor Swift Songs processed using KMeans (k=2)

Processing Taylor Swift’s songs in our KMeans, with k=2, results to the following clusters:

Cluster 0 — high acousticness, low energy, low valence
Cluster 1 — low acousticness, high energy, high valence

If we try to visualize Taylor Swift’s songs to see how they are labeled and distributed across the different clusters, we can see below that there is a mix of country and pop songs in each of the clusters:

Findings:

  1. The cluster characteristics produced by our clustering algorithm have the following features:
  • high acousticness, low energy, low valence
  • low acousticness, low energy, low valence,
  • low acousticness, high energy, high valence

2. With the audio features we were able to collect from Spotify, none of these features could clearly distinguish a country song from a pop song. Although a slightly higher percentage of country songs are classified under the cluster with high acousticness, and a slightly higher percentage of pop songs are classified under clusters with low acousticness, our results still show a large overlap in values for these features for these two music genres, that is pop and country songs are spread out across all three clusters.

Summary:

To answer the questions we have initially formulated:

How does country and pop music differ?

Surprisingly, it appears that there are no distinct differences between the country and pop music for songs released in the 1990s and onwards, at least for the given features we were able to extract from Spotify.

Are there differences between the two music genres? Can we find some patterns that would differentiate these two music genres?

With the analysis done using the song features extracted from Spotify, there are no distinct differences between these two genres, and the clusters generated were not able to distinctly classify these two genres, as shown in the large overlap between country songs and pop songs across the clusters.

What patterns do we find with the song features?

We did find that the main features making up the clusters were the acousticness, energy, and valence, where one cluster has a distinctly low acousticness value, and the other two clusters with high acousticness varies in energy and valence.

__________________________________________________________________

Country and pop songs from 1990’s onwards appear to have the same features, other than country songs are sang with a distinct southern accent perhaps??? — We will need an accent detector to prove that, and is out of scope for this analysis.

From our findings, it does not seem like the song features we have gathered define the genre, at least for country and pop music. With the current pop and country music scene, could it be that it is more the people (where they are from, their personality, the culture they associate with) rather than the song that defines the genre??? What are your thoughts?

Lessons Learned:

When I started out on this project I had the assumption in my head that pop and country songs are different, because they are different genres of music. I initially struggled looking for features and was becoming frustrated that I am unable to see distinct clusters between these two genres, until I decided to let go of the assumption, and let the data and the clustering algorithm do what it does, to show us what is — which is the beauty and magic of data and data science, it is able to answer and clarify the assumptions (false or true) we have in our minds. It is able to give us information we would not have known otherwise if we are just merely observing.

--

--