While the original Necho Est API had a lot of good genre information on artists, tracks and albums, we initially discovered the new Spotify API was very sparsely populated. In order to extract enough genres to make our interactive work, we had to use some creative API processing.
We started by accessing the user's top tracks from the longest period of time that Spotify provides, giving us as many tracks as possible. We also accessed tracks from discover weekly but weighted them lower than top tracks – discover weekly is just a suggestion (based on previous listening) while top tracks actually show what people have been listening to.
Very few of the tracks had genres, but we learned that artists are more likely to have genres attached to them (as will albums sometimes). We gathered genres from all tracks, from all albums where these tracks appear, and all artists that made those tracks. We mashed all of those together using some weighting algorithms (top tracks have priority etc.). Our results would have been better if Spotify put more genres into their database – for example, even big bands like Muse and U2 are missing genres on their tracks.
Another a challenge was to get 1,400 genre descriptions. We were able to find about 900 genres from an old EchoNest API endpoint that was still functioning as part of a demo app. We used Wikipedia and the urban dictionary to find the rest. Some we simply had to write ourselves. We then categorised the genres into master and sub genres to be able to allocate colours to each master genre in order to visualise a user’s musical DNA.
Once we had displayed the genres we were able to find Spotify created playlists (The Sounds of Spotify) for each genre, meaning a user could follow or discover new music within that genre.