How has popular music evolved over time? Why has it changed? As part of the R For Data Science TidyTuesday series, I quickly analyzed a large dataset of Spotify songs, which included detailed characteristics of each song. The visualizations below were created using R. All code can be found on github here.
All genres and characteristics over time
Each of the 30k songs in the dataset are categorized by genre. Values are also assigned to each song based upon 12 music characteristics, such as acousticness, temp, and loudness.
For example, the danceability of rap songs experienced its nadir in the early 2010s but has started to increase again in recent years.
Moreover, the loudness of rock songs has steadily increased over time.
Linear Model
What can explain these changes over time? What determines a song’s popularity? The Spotify data includes a measure of each song’s popularity. A generalized linear model can help us understand.
track popularity ~ glm(danceability + energy + key + loudness + mode + speechiness + acousticness + instrumentalness + liveness + valence + tempo + duration)
term | estimate | std.error | statistic | p.value |
---|---|---|---|---|
(Intercept) | 77.827 | 1.674 | 46.481 | 0.0000 |
danceability | 5.043 | 1.049 | 4.809 | 0.0000 |
energy | -29.519 | 1.198 | -24.642 | 0.0000 |
key | 0.043 | 0.037 | 1.143 | 0.2532 |
loudness | 1.525 | 0.064 | 23.764 | 0.0000 |
mode | 0.718 | 0.273 | 2.627 | 0.0086 |
speechiness | -7.254 | 1.356 | -5.348 | 0.0000 |
acousticness | 3.222 | 0.732 | 4.402 | 0.0000 |
instrumentalness | -11.979 | 0.630 | -19.005 | 0.0000 |
liveness | -4.312 | 0.882 | -4.890 | 0.0000 |
valence | 2.783 | 0.641 | 4.340 | 0.0000 |
tempo | 0.021 | 0.005 | 4.171 | 0.0000 |
duration_ms | 0.000 | 0.000 | -20.170 | 0.0000 |