Spotify is one of the largest audio streaming platforms on the internet. It had originated in Sweden in 2006. Currently averaging 574 million active users.
As such a successful audio streaming platform, they have a multitude of services provided. One of which, being the ability to visualize a song’s populariry amongs listeners. Although a song’s popularity is solely based upon the number of listeners who hae streamed the artist’s music, today we are studying the trends within popular songs. What makes a hit song a hit song?
To answer this question we are going to be observing the data and measuring the highest ranking songs in terms of:
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## âś” dplyr 1.1.3 âś” readr 2.1.4
## âś” forcats 1.0.0 âś” stringr 1.5.0
## âś” ggplot2 3.4.4 âś” tibble 3.2.1
## âś” lubridate 1.9.3 âś” tidyr 1.3.0
## âś” purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## âś– dplyr::filter() masks stats::filter()
## âś– dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
spotify_df <- read_csv("Downloads/Midterm Project/spotify_songs.csv")
## Rows: 32833 Columns: 23
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): track_id, track_name, track_artist, track_album_id, track_album_na...
## dbl (13): track_popularity, danceability, energy, key, loudness, mode, speec...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
spotify_df <- spotify_df %>%
mutate_at(vars(liveness), as.numeric)
Is there a correlation between each category in relation to the track’s popularity? This can determine and narrow down the aspects of a track that are key to deciphering how to make a hit track on spotify.
To do this we will be observing each category based upon a graph that will show either a negative, stagnant, or positive correlation between said category and the track’s popularity.
First relationship we will be observing will be danceability. This measures how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable.
This data is going to be marked in two separate ways. First we will look at a line graph that encompasses all tracks and their danceability scores. Secondly we will focus more on the songs within the top 20 and provide a bar plot on their danceability scores to get a closer look on how much the numbers differ from point to point.
ggplot(spotify_df, aes(x = track_popularity, y = danceability)) + geom_line()