Spotify is one of the most famous Music Platforms to discover new music. The company uses a lot of different algorithms to recommend the user new music based on their music preferences and most of these recommendations are located in Playlists. These Playlists are created for different users based on a wide diversity of music genres and even Spotify is capable to recommend new music based in moods.

Music has been in my daily routine during all my life, It’s a kind of drug that I need when I’m doing housework, working at the office, walking the dog, workouts and so on. I have a lot of music on Spotify that I always wanted to separate according to the similarities of the songs and save them into different playlists. Fortunately, with a little knowledge of Machine Learning Algorithms and Python, I could achieve that goal !!!.

So to do that, first I will list the tools required and some definitions of the Spotify Audio Features that I will use for built the Clustering model.

Tools:

  • Pandas and Numpy for data analysis.
  • Sklearn to build the Machine Learning model.
  • Spotipy Python Library (click here for more info).
  • Spotify Credentials to access Api Database and Playlists Modify (click here for more info).

Spotify Audio Features:

Spotify uses a series of different features to classify the tracks. I copy/paste the information from the Spotify Webpage.

  • 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: 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: Energy is 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. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy.
  • Instrumentalness: Predicts whether a track contains no vocals. “Ooh” and “aah” sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly “vocal”. The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0.

#k-means #spotify #music #python #machine-learning

Clustering Music to Create your Personal Playlists on Spotify
7.30 GEEK