The World Through Music

Can we use music to analyze sentiment?

Yasvi Patel
VisUMD
6 min readDec 14, 2021

--

Decorative image of headphones
Photo by Icons8 Team on Unsplash.

Written by Yasvi Patel and Jocelyn Sun

What’s your audio aura on Spotify Wrapped? The trend of using music to gauge moods and emotions is not unheard of. Several applications and websites generate landscapes and even quotes based on your playlist’s mood. It’s fun, it’s personalized, and sometimes it’s eye-opening. That’s when we thought — How about we magnify the scope and look at the entire world through this musical lens?

Still not sold on the idea? In our research, we found that many studies and applications out there including Spotify use the musical composition of songs to analyze listeners’ emotions. But the composition itself is not the only reason we listen to Taylor Swift on repeat at 1 am. Lyrics play an equally important role in revealing the emotions of a listener.

In fact, historians often use song lyrics when trying to understand public sentiments. One example of this is Nina Simone’s Mississippi Goddamn which topped the Billboard charts in 1969. The lyrics of this song reveal the frustrations of the African American community during the civil rights movement and are often used as historical artifacts.

So clearly, song lyrics reveal strong public sentiments. We were motivated to look for a dataset that has the top songs and their sentiments. After a week of exploring the deepest parts of the web, we had no luck. At that point, we just decided to create our own dataset.

Data Collection

For the scope of this project, we chose 7 countries and selected its top 20 songs. We looked at the last weekly chart of every month in the year 2020. We were curious if the sentiments of these songs revealed anything interesting about these 7 countries that were buzzing on the news during the pandemic.

We used Youtube Music’s charts to get the song dataset. Why? Because:

  1. It is free
  2. Its charts are inclusive of popular local songs for countries like India and South Korea.
  3. Its ranking system doesn’t just rank the songs. It also includes user-generated content like song covers, lyric videos, and music videos. This means that the charts include throwbacks and even guilty pleasures. Sorry, not sorry!

We then manually fetched all the song lyrics using Genius, Google, and Google translate (for non-English songs) and analyzed their sentiment using MonkeyLearn’s generic sentiment analyzer. This gave us the song’s sentiment and confidence level (a percentage showing how confident MonkeyLearn is in analyzing that sentiment).

Now that our dataset was complete, We dove into designing!

Design Process

We began our design process by looking at the characteristics of our dataset. We then came up with basic visualizations that fit certain aspects of our dataset. As we narrowed down our options, we decided to take a step back and find limitations in our sketches. This zoom-out process helped us with our final sketch — an amalgamation of the pros in our previous sketches.

Let’s take a look at the highlights of this process.

Sketch 1: What is the most informative way of categorizing our data?

Sketch showing three categories of dataset: Rank, Temporal and Spatial
Sketch 1: Categorized data into rank, temporality, and spatial

Sketch 2: Temporal and spatial show potential. Let’s create one visualization for each of them. An area chart for temporal and an adjacency matrix for spatial.

Sketch 2 & 3: Visualizing the temporal and spatial properties of the data

Sketch 3: Can we make it more fun for our target audience? How about a cartogram that for each country shows a heatmap of the top 20 songs for all the months in 2020.

Sketch showing a final cartogram
Final Sketch: Cartogram which shows both temporal data and spatial data

It was finally time to start developing. As we continued refining our final sketch, we used Tableau to start creating the visualization. To create a better user experience, we used Wix to build a website and embedd the tableau visualizations.

The final result!

Check out our website. See if you can find a throwback in there or look for your favorite 2020 jam. Here’s a quick demo:

What do our users are say about these visualizations?

“Wow, it looks so cool!”

“Tell me a song and I’ll guess it’s rank! [*hovers over the map] See I was right!”

“Damn, Japan is so positive, I wonder why? [*scrolls to the sentiment-covid chart]”

“Let’s find how many of my artists showed up here”

Reflection Time!

While creating these fun and engaging visualizations, we further explored the trends and implications (or the lack thereof) of our data. We found the constraints we have in data collection which might, in turn, affect the outcome of our visualizations.

Unobserved External Factors: Several factors affect our choice of songs to stream like politics, human rights, ethnic conflicts, natural disasters, etc. We realized that finding a correlation between one single external factor and the overall public sentiment is complex, especially since isolating one factor is extremely hard.”

Also, our current visualization also doesn’t reflect personal variability from pop culture phenomenon, and holidays and private events like weddings.

Given these limitations, what’s next on our list? Due to the limited time and budget, we tested our idea using free, open-source resources. We are certain that using music to analyze sentiment has immense potential. If we have more resources, we would propose the following improvements:

Increase Coverage: Even though Youtube Charts have many pros, it is restrictive to the user that streams on their platforms. This leaves out a significant group of music listeners especially from countries where Youtube is banned.

To be more inclusive, we would use paid resources like SoundChart or ChartMetric. These platforms create monthly charts which analyze more than one streaming service across the globe. They also include more countries than a dataset from a single streaming service.

Increase Accuracy: While using a generic sentiment analysis tool gives us a decent overview of the sentiments, we would like to use more specific cognitive models. Training models like Thayer Mood Model and Russell Classification using machine learning provide more accurate sentiment analysis.

We would also like to add instrumental music sentiment analysis as a supplement to song lyrics in the above models. This would provide a more holistic view of the song’s sentiment.

Lastly, we want to look for a more language-specific sentiment analysis tool for the analysis of non-English songs to minimize the effect of loss in translations. We also want to incorporate a purpose-specific sentiment analysis model to better differentiate the use of language (e.g. sentence structures) in normal and lyric writing

Improve Accessibility: While both our visualizations are fairly accessible they are not the most color-blind and screen-reader friendly visualizations. We would like to add a tabular visualization to our website to make it more accessible and find alternative color schemes that are color-blind friendly.

--

--

Yasvi Patel
VisUMD
Writer for

Product designer looking for inspiration through unique ideas and different perspectives.