Organize songs by key with KeyMaster
KeyMaster takes any Spotify playlist and organizes the songs into new playlists, grouped by key and mode (e.g. B Minor, A Major, etc.).
See GitHub repo and try it here!
The motivation to create and develop this project was to practice communicating with APIs (see Section 2), designing a front-end and deploying (via Heroku).
1. Playlist URI
The user is asked to enter a playlist's URI, which can be accessed by clicking on "Copy Spotify URI". For example, the URI for the Spotify-curated playlist "Rock en Español" is spotify:playlist:37i9dQZF1DWYN0zdqzbEwl
2. Authorization
KeyMaster begins an OAuth authorization process to obtain permission from the user to create playlists on their behalf on Spotify.
More info can be found here.
The app receives a code from Spotify's Accounts Service (their authorization API), which is then exchanged for a short-lived access-token that can be used to communicate with Spotify's Web API to retrieve playlist and track information, as well as to create playlists, add tracks to playlists, etc.
The app then gets information on the tracks from the playlist that the user entered. Spotify's API offers information on a track's audio features, which includes key and mode, as well as other interesting analysis like 'danceability', 'instrumentalness' and more.
3. Create new playlists
After the tracks are automatically entered in a database along with their information, new playlists are created on the user's behalf on Spotify. These playlists are private and only visible to the user. Tracks are then added to the corresponding playlists.