SHØ logo

Radio algorithm

I implemented an algorithm that takes a user's input as a song title and returns the list of songs that should be played in order; like a radio.

The algorithm uses a dataset of songs that I found online (originally obtained from Spotify) to build a Red-Black tree based on how close each song in the dataset are to the initial song specified by the user. Two songs being close is defined as having similar characteristics in terms of attributes such as acousticness or tempo. By playing songs in order from closest to furthest, I expect the radio to play in such a way that transitions between each song are smooth and the atmosphere is never abruptly ruined.

I chose RB trees as the appropriate data structure to use in this application because it guarantees the deepest branch to be only at most twice as deep as the shallowest branch. This makes the structure suitable to deal with large datasets, such as a catalogue of songs.