Inspiration

Ever get sick of hearing the same artists every time you click shuffle? Ever wonder about the songs you haven't heard in ages because they never get played sooner? Ever ponder if shuffles are predetermined based on popularity?

We do.

What it does

Reads your music library and attempts to build a shuffled playlist based on user-defined parameters.

How we built it

This project was split into two parts;

  • Spotify web integration: A website that allows the user to sign into their Spotify account and retrieved their liked songs. With this data we could feed it into the algorithm and create a playlist based on the shuffle.
  • Python shuffling logic: A script that takes a given file path to the user's music directory and filters through the songs based on the given rules. Once the operations are complete, it returns the shuffled playlist as output.

Challenges we ran into

  • Trying to authenticate with Spotify was a huge headache as the variety of solutions out there didn't quite work as intended. We had to come up with ways to take as much of the process of signing in away from the user and have it automated on the back end.
  • Feeding the Spotify data into the algorithm gave issues as you're not working with real files and instead would have to build an emulated filesystem based on the expected input data for the algorithm.
  • Keeping track of music data. To keep requirements and development simple, we didn't want to have to integrate with a database to be able to work on the song data. Instead we created a solution to make a fake database on the fly.

Accomplishments that we're proud of

  • Taking a lot of the authentication issues away from the user was a great accomplishment as it simplified the experience for the end user and would provide less opportunities for error.
  • The abstraction of data for the algorithm. It has been designed to work with numbers so that it can be expanded to work with more things than just music. Once the shuffling algorithms are improved further, abstracting the data into numbers provides for a standardised way of interacting with the data.

The code developed for the shuffling algorithm is in this repository. Likewise, the code for the web interface is stored here

What we learned

To be able to build an algorithm that would work with multiple music platforms (Spotify, Google Music, Apple Music, etc.) would be too much of a hassle to find a way that would work across them all (if they even provided a good API). It was better to break away from a company specific solution and instead develop something that could be standardised.

What's next for Pseudo Shuffle

Expand with more shuffling algorithms and apply user-defined weightings to them so that 'heavier' algorithms will take precedence over 'lighter' ones when it's impossible to evenly apply said algorithms.

Build libraries for the streaming services so the output can be fed into the algorithm to allow for a wider audience use-case.

Share this project:

Updates