Welcome to the DJ Assistant

A smarter way to organize your playlists.


Continue to Select Playlist

What is the tool?

The DJ Assistant is a web application that connects to Spotify and helps you rearrange the songs within your playlists based on BPM (Beats Per Minute) to match a desired BPM profile. This tool is a quick way to reduce the workload to create West Coast Swing dance playlists, and it will automatically upload the playlist to Spotify for you. This tool was created primarily as a fun project for Yours Truly to learn Web 1.0 development during his journey to become a software engineer.

Why use the tool?

Dance playlists need to vary in BPM so that there aren't too many fast or slow songs played consecutively, otherwise dancers will get hot and stop dancing, or get bored and stop dancing. The DJ Assistant ensures a smooth and enjoyable dance experience by intelligently ordering your tracks.

How does it work?

The target profile is defined as discrete BPM targets for a song at a given index in the playlist. The DJ Assistant reorders the songs in the playlist such that it minimizes the overall error between the BPM of the actual songs and that of the target profile. Simply put, it tries to make the BPM curve of the playlist match the target BPM curve. This task is a variant of the classic assignment problem in computer science and can be efficiently solved using the Hungarian algorithm, which is implemented in Scipy. The song information, including BPM, is retrieved from the Spotify API.

What functionality is included?

With the DJ Assistant, you can:

  • Rearrange playlists to match a desired BPM profile.
  • Analyze existing playlists and create an interactive plot that shows detailed information about the playlist.

Example Profile

Example Profile

The example profile shown above is a sine curve with tempo (in BPM) on the y-axis and song index on the x-axis. It was created using the built-in profile creator in the app. The goal of this profile is to spread out the songs along the sine curve to create a natural ebb and flow in the dance energy. This ensures that high-energy songs are followed by lower-energy ones, allowing dancers to catch their breath and preventing listener fatigue. By alternating the tempo in a wave-like pattern, the playlist maintains a dynamic yet balanced progression, enhancing the overall dance experience. The profile is defined manually by the user, setting the desired minimum BPM, maximum BPM, and number of cycles. The songs of the playlist that you select will then be spread along that profile. Making an ideal dance playlist requires manual tuning from the user. Once a playlist has actually been fit to a given profile, the user must look at the new arrangement and decide if the songs are appropriately spread out. If they are not, consider adding more cycles to the profile.

Example Analyzed Playlist

This is an example of an analyzed playlist. The algorithm took the playlist which was provided and attempted to match the BPM of the songs to the target profile. Hover over the points on the plot to see details about the songs.

This website is simply a GUI for the underlying Python library that was written to provide the playlist sorting functionality. This tool followed the principle of API driven development, meaning the Python library is a superset of the functionlity provided by the limited GUI available here. Visit the GitHub repository for more information regarding the Python library.

Future Improvements

If we get enough users, we plan to introduce several exciting features:

  • Implementing other optimization algorithms, such as genetic algorithms, to further improve playlist rearrangement.
  • Automatically smoothing out song progression to limit the number of consecutive fast/slow songs without requiring a predefined profile.
  • Considering the key of the song to ensure smoother transitions by placing songs in the same key next to each other.
  • Taking into account the "feel" of the song, as reported by the Spotify API, to group similar songs together, such as placing floaty songs near other floaty songs and high-energy songs near other high-energy songs, creating distinct flavors within the playlist.
  • Adding customizable profile definition instead of the built in sinusoidal profile. For instance, perhaps a sine profile with exponential damping to reduce the playlist variation would be more ideal.
  • Leveraging HTMX and moving towards a more modern UI feel, instead of the current Web 1.0 app architecture.