library ( spotifyr )
library ( tidyverse )
library ( scales )
Analysing My Current Optimum Workout Playlist
Photo by Norbert Buduczki on Unsplash I first needed to understand the Spotify sound recording features that define what I presently consider to be my optimum listen experience for vigorous or high intensity exercise. fortunately, I had a representative playlist to analyse ( “ my optimum playlist ” ), consisting of 26 tracks that I presently default to whenever I need that consistent high tempo rhythm and resounding bassline .
Finding The Spotify ID Of My Optimum Playlist
I used the serve
get_my_playlists(limit = 50) to retrieve the first 50 playlists in my library. From the resulting data skeletal system, I was able to locate the
id of my optimum playlist, which I named
my_optimum_gym_playlist_id. If your library includes more than 50 playlists, you will need to besides include
offset = 50 to retrieve the next 50 playlists within your library.
Understanding My Optimum Audio Features
now that I had the relevant Spotify ID for my optimum playlist, I used the function
get_playlist_audio_features() to retrieve a data frame of the popularity and audio features of every track within the playlist. For my initial analysis, I plainly wanted to understand where each track in the playlist ranked within a typical valence/energy emotional quadrant model, where :
- low energy/low valence songs are considered “sad” or “depressing”;
- low valence/high energy songs are considered “angry” or “turbulent”;
- high valence/ low energy songs are considered “peaceful” or “chilled”; and
- high valence/ high energy songs are considered “happy” or “joyful”.
Using the code above I was able to visualise where each song in my optimum playlist ranked emotionally : As we can see from scatter plat above, my optimum playlist did not consist of depressing or chill tracks, and all tracks ( except one ) had an “ energy ” value above 0.50. As I expected, my optimum playlist comprised of high energy tracks. Spotify states that “ energetic tracks feel fast, forte, and noisy ”, which is a relief given that this particular playlist is supposed to represent my go-to excerpt of songs for high tempo and high saturation workouts. After using the aroused quadrant exemplary to visualise each track from my optimum playlist, I wanted to understand if there were early big characteristics of this playlist that I could use as a benchmark to create my ideal workout playlist library. By using the above code, I was able to transform the original
my_optimum_gym_playlist_audio_features data skeletal system into long format, which I could then use to create concentration plots and a table to summarise the sound recording features data . After reviewing the plots and summary mesa, I noted the take after features from my optimum playlist :
- Tempo of tracks was above 89 bpm;
- Loudness was below -3 dB;
- Instrumentalness was less than 0.0062;
- Key was an integer value ranging from 1 to 11;
- Mode of tracks was either 1 or 0;
- Acousticness, danceability, energy, liveness, speechiness, and valence of tracks ranged from 0 to 1; and
- 2 out of the 26 tracks were released before 2018.
Although the concentration plots provided a good ocular of the distribution of values, I besides created a boxplot of each sound recording feature so I could beneficial visualise the values relating to each racetrack within my optimum playlist. Given the variation and range in values of the different audio features, to display my initial boxplot visual image, I excluded “ tempo ”, “ volume ”, “ key ”, “ modality ”, “ instrumentalness ”, and “ track.duration_ms ”.
I used the code above to create the come boxplot visual image of my six selected sound recording features : For more information about what each sound recording feature of speech represents, visit the Spotify developer page here. The code above was then used to create a second base boxplot visual image of the other six remaining sound recording features :
Which Genres Did I Prefer?
now that I had analysed the Spotify audio features of my optimum playlist, I besides needed to understand the writing style assigned to each artist within the playlist. Using the code above, I was able to summarise and create a bar chart of the genres assigned to each artist within my optimum playlist :
Read more: The Top 150+ Best Old Bollywood Songs
Looking at the graph above, anyone who knows me will not be surprised by the results because, although I have an affinity for US hip hop, I do presently prefer the sounds of UK pelvis hop and dirt for high intensity workouts. To paraphrase the great Bob Marley, when the music hits me, I feel no pain ! There ’ south barely something about UK tunes and their beats .
Initial Insights From Analysing My Current Spotify Workout Playlist
now that I had analysed the audio features of my optimum playlist, the following depart of this action was to decide on the allow doorsill values ( min/max ). After reviewing the versatile graph, tables, and data frames, I decided on the follow optimum criteria for modern exercise tracks :
- Energy > 0.67;
- Danceability > 0.64;
- Tempo > 100 bpm;
- Track Release Date > 2017–12–31;
- Instrumentalness < 0.0062;
- Liveness < 0.20;
- Speechiness < 0.33;
- 120,000 ms < Duration < 420,000 ms; and
- -11 dB < Loudness < -3 dB.