Smartify - A Spotify-Powered thematic album queue
We all know how it feels to be listening to an energetic song and suddenly getting pumped up, only to find that the next song in our shuffled queue is sad and depressing. That not only ruins the mood of the album, but also the general consistency.
Luckily, Spotify provided me enough breadcrumbs along the way through their various APIs to be able to build the solution to this very problem - a thematically consistent album generated, deemed "Smartify."
Smartify takes factors like "danceability," "valence," "key," "energy," and "speechiness" (as described in the FAQ in the website below) - all major thematic defining factors of songs that we commonly know - and computes the standard deviation between the "scores" for each of these factors for every song in the playlist. Then, Smartify will find the song with the smallest "standard deviation" and add it to the queue. The previous song is then appended to a "played" list, thereby ensuring that the song does not get replayed and that Smartify doesn't fall into a loop - after all, it's supposed to be smart.
After that, it'll generate a Spotify playlist for you (after you sign in and give it permissions) that follows a thematically consistent ordering. You can then add/remove songs at your leisure. If you're only using Smartify to find similar songs within playlists/albums, you can also preview the songs through Spotify's inbuilt player (although the preview is only 30 seconds).
You can also view the lyrics for songs that are not instrumentals :)
Edit: Not true since my API website is really slow... will have to find another way
TL;DR: What's so special about Smartify?
Fact is, if you have a playlist, it's very likely you don't want recommendations outside that playlist (or far off of the theme). Because of this, things like YouTube autoplay seem rather deprecated. On the other hand, our playlists are often shuffled into jumbled and inconsistent queue's in terms of how they sound - Smartify offers a two-fold solution by ensuring that the content of your albums/playlists stays the same, but that the order is optimized to be the very best by grouping similar songs together.
So, without further ado, here it is:
And its nemesis:
You can now search for your favorite albums/playlists, so you do not need the IDs below
Here are some ID's to try, unless you want to test your own:
Drake's Scorpion: 37i9dQZF1DX1YF6nTEHymi
Post Malone's Beerbongs and Bentleys: 6trNtQUgC8cgbWcqoMYkOR
Elton John's Diamonds: 1uzIyRT1QxDx4fMIX0UiAE
Getting an Album ID
For any album sharing link, it will be in the format:
Just paste the ID into the homepage's text box and it should work.
Forbidden/CSRF Token Trouble
For some reason, repl.it's embedded applications cannot implement CSRF form tokens, so you'll need to open the site in a new window.
Yep, unfortunately this is the biggest issue right now. Since the views reference one class, overlapping users may experience overlapping album. As such, I recommend that you create a playlist to ensure that your "progress" will not be deleted if another user logs on.
Since up to this point I've just been adding new features, the code looks somewhat dirty and is often repetitive - I have to fix this once I get the general sense that Smartify satisfies all features anyone would ever want.
Please let me know if you have any suggestions. I literally created this a week ago, and I'm quite proud of it but there's a chance I'm overlooking something. If you want me to let the site play the full songs, don't worry, that's exactly what I did (but you may need Spotify Premium - something I'll fix soon enough).
We're currently at 2,572 page views (as of 11:30AM PST, 7/20)
- Add domain & Cloudflare
- Share playlists?
- Lyrics comparison --> Really slow right now
- Entropy --> Will allow external albums as entropy increases and conform to the current album as entropy is close to 0
- Use of advanced data structures (actually taking a course on this haha) -> use priority queues
- General refactoring
Hello! I am currently trying to make a version of this that has more licensed music, could I have permission from you?
btw if you're having overlap issues (as in - a different album pops up while you're going through your queue) you should try the fixed version: https://smartify-4--shadowcypher.repl.co/
Only reason that it's not on the live site is that the submission deadline passed, so I technically can't revise it until the competition ends :(