It’s really rewarding when you develop a script that automates a small part of your life.
Recently, I managed to pull one off which automates part of designing DJ sets.
Before jumping into the program itself, I need to explain a couple things about how I make my mixes, and how I DJ. These are important in understanding how my tool works.
-The music I use to DJ are all files saved on my hard-drive.
-I scan the files with a key detection software (Mixed in Key) which helps detect what musical key my music is written in.
-Mixed in Key also detects the ‘Beats Per Minute’ (BPM) of a song, which is a value representing the tempo.
-My DJ’ing often involves matching the BPM of two songs, allowing them to blend seamlessly.
-Most digital DJ software matches the bpm of two songs for you (called ‘sync’), but my hardware setup (Pioneer CDJ-900’s) does not.
I used beatmatch ‘by ear’, but I discovered an easier way. I can use an algorithm to to beatmatch for me. It’s quicker and more precise, but requires me to write down how much faster or slower each track is than the ‘Set’s BPM’.
I usually write this info on the filename for each song. This whole process used to require crunching numbers of a calculator, then renaming every file in the set.
Now, all I have to do is run a single python script.
Let’s say I’m trying to develop a DJ set.
(Usually a set would be anywhere between 20-30 tracks, but to keep things simple, this one’s 2 songs.)
I already ordered the songs, so I know I’m going to play ‘Don’t Wanna Cry’ before ‘Great Fairy Fountain’. That means it’s time to use my tool.
The Beatmatch Encoder first reads the BPM of the set (or part of a set) and a folder which I’ve planned a DJ set in. I do this my altering the variables for the DJ directory, and for the ‘base BPM’. In this case, ‘example set’ is the directory, and ‘160’ is the set’s BPM.
When run, the script loops over the filenames of all the songs in that folder, reads the BPM of them, does some quick math to find the percentage difference between the song and the set’s desired speed. The script then prints this percentage right after the song’s number.
As you can see, I now have these BPM differences in an easy-to-read format.
Since my DJ equipment reads filenames, all I have to do is read the file on my equipment, and I instantly know what speed to put it at to be a perfect match.
Doing this file-editing manually would take ~20 minutes a set. Now it takes 20 seconds.
While I expect this particular tool to be of niche interest to others (you’d have to mirror my workflow for preparing DJ sets to find this tool practical) but hopefully this gave a little insight into how to simplify your life with a little code.