Music is a form of language
I consume music for more than 60% of my waking hours on a daily basis. I put on a playlist as soon as I am awake in the morning. I am listening to music when I am cooking eggs for breakfast, when I am commuting to and from work, when I am deeply engrossed at work and when I am trying to substitute running for a gym workout. I spend more time choosing and queueing the songs that I want to listen to in the shower than actually showering. It is safe to say that my music streaming game is stronger than my binge watching game.
So much music led me to think: does the type of music that we listen to depend on the time of the day? If it does, how to quantify it? Does the music over the course of the day narrate a story that reflects the day accurately?
This analysis is an attempt to find an answer to the above questions.
Approach and Data Collection
For the purpose of this analysis, I have divided a workday into the following parts. Assuming that the music played at each of these parts has different attributes.
Holding true to its brilliant ads with the tagline Music for every mood, Spotify has several playlists curated for all times of the day. For each part above I just searched that keyword (morning for Morning) and collated the top five playlists created by Spotify (excluding user-generated playlists) based on the number of likes on each. For each playlist, I used the playlist ID to get track IDs and then used the track IDs to fetch audio features from Spotify’s API.
Spotify developer API provides the following interesting features for individual tracks.
- Acousticness: a confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic.
- Danceability: describes 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.
- Energy: a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy.
- Instrumentalness: predicts whether a track contains no vocals. The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content.
- Speechiness: detects the presence of spoken words in a track. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music.
- Valence: a measure from 0.0 to 1.0 describing 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).
More features, detailed definitions and distribution of each feature can be found at this link from where the above definitions have been trimmed, copied and pasted.
Using the Python implementation Spotipy of the API, I retrieved audio features for all songs of the 40 playlists chosen earlier.
Radar charts are wonderful tools!
The idea here is to see (i) how the musical attributes compare with each other at any time of the day and (ii) how they change during the course of the day. The simplest way to show that usually is a time series chart but with so many attributes it would have been incomprehensible. The next logical option is to plot a grid of time series charts for different attributes but then it would not allow me to juxtapose different attributes with each other.
I decided to focus on (i) above and plotted a grid of radar charts which are a great way of visualising multivariate data. There are six variables that are shown below each of which has a value ranging from 0 to 1. For each individual chart in the grid, the value plotted against each feature is the mean of that feature for all songs in the top five chosen playlists for the respective time of day.
Let us for the rest of the article assume that there exists a person, say Joe who possesses the average musical attributes as shown by the charts below.
How does Joe’s day look?
Morning: After (hopefully) a good night’s sleep Joe wakes up listening to happy acoustic (0.43) songs. His energy (0.52) is not the highest yet but he is still dancing (0.59) around while freshening up and getting ready for a heavy workout.
Playlists: Morning Acoustic, Morning Stroll, Morning Commute, Morning Motivation, Top of the Morning
Workout: Joe continues his day with the morning’s happy (0.45) state and reaches the highest energy (0.77) levels of the day. He does not hesitate in unleashing the beast inside and goes all in which leaves him pumped up for the rest of the day.
Playlists: Beast Mode, Motivation Mix, Workout, Power Workout, Cardio
Work: At work, Joe puts on his headphones and goes into a state of flow listening to highly acoustic (0.76) and instrumental (0.85) music.
Playlists: Brain Food, Deep Focus, Music for Concentration, Perfect Concentration, Workday Lounge
Evening: After a long and hard day at work, Joe listens to acoustic (0.71) music possibly bobbing (0.52) his head once every song while deciding if he wants to order in or cook something.
Playlists: Evening Acoustic, Evening Chill, Evening Commute, Evening Jazz, Evening Groove
Cooking: Joe decided to put on his apron and he could not be happier (0.65) with his decision. He loves grooving (0.66) around energetically (0.52) chopping veggies and flipping them around in a pan.
Playlists: Kitchen Swagger, Your Kitchen Stereo, The Blues Kitchen, Cooking with Soul, Cooking with Swing