← All postsGuide
How to order a DJ set: key first, then tempo, then energy — and why the pool matters more than the algorithm
Preparing a set means putting your tracks in an order. And almost every time you want three things at once: two tracks in a row should share a compatible key, their tempos should be close, and the energy should follow where you want the night to go — building, peaking and coming down, or rolling in waves.
Keeping all three perfect is usually not possible. So the question becomes: when they conflict, which one wins? And there's a second question that gets asked less often: how many tracks should you have to choose from?
Why key comes first
Key compatibility works like a line you either cross or don't. On the Camelot wheel, our app's compatibility score gives 100 for the same key, 88 for one step around the wheel and 85 for the other letter of the same number; two steps drop to 62, a diagonal neighbour to 55, and further away it drops more. The first three — same key, one step, letter switch — are the wheel's "safe" moves. When this post says compatible transition, it means those: a score of 85 or more. How the score is built is in our Camelot wheel post.
In a long blend, the harmonic layers of two tracks play together for a while; if the keys don't match, you hear it for that whole section. A small tempo difference, on the other hand, closes with the pitch fader. That's why we put key first and tempo second.
Then tempo
Tempo has a range. In the measurement below, we aimed for a difference of 2% or less between two tracks.
One warning: with key lock off, the pitch fader moves the key too. A 2% push shifts the pitch by roughly a third of a semitone; around 6% is a full semitone, which is a different key on the wheel. The bigger the tempo gap, the more it undoes the choice you made for key. The details are in the "tempo trap" section of the Camelot post.
Energy last
Of the three, energy is the hardest to measure. Key and tempo are physical properties of a track; energy is largely a judgement: how dense the arrangement is, how hard the drums hit, how a floor reacts to it. The energy numbers tools give you are a guide, not a replacement for a DJ's ear.
So we treat energy as the curve of the order: it sets the overall direction of the set, but it doesn't get to break key and tempo on individual transitions.
Two ways to sort a set
There are two basic ways to sort a list by these three criteria automatically.
The greedy way. Start with one track; at every step, pick the track that best fits the one playing right now. Simple and fast. It has two weak spots:
- Because it only looks one step ahead, it can paint itself into a corner: the choice that looks best now can leave nothing that fits three tracks later.
- If key, tempo and energy are added up into one weighted score, a track with a great tempo match but the wrong key can beat a track with the right key and a slightly wider tempo gap.
The look-ahead way. Instead of building one list, you keep many partial lists open at once and at each step score the whole list. The priority is strict: key compatibility first, then tempo, then the energy curve. That way a dead end caused by an early choice can be seen.
We measured it: which method, and how much it matters
We ran both methods side by side on the same pools. The material: the House folder in the library of our founder, Enes Ayata — 559 tracks with key and tempo information. Keys and energy came from the tags already in the files.
From that folder we drew random pools of 40, 20 and 14 tracks and built a 12-track set from each. For every pool size: three energy curves (building, peak, wave) and 40 different pools per curve, so 120 sets per pool size. We measured two things: what share of consecutive transitions were key-compatible (85 or more), and what share had a tempo difference of 2% or less.
| Pool | Compatible transitions: greedy → look-ahead | Tempo gap ≤ 2%: greedy → look-ahead |
|---|---|---|
| 40 tracks | 96–98% → 100% | 92–95% → 100% |
| 20 tracks | 91% → 95–98% | 86–87% → 95–98% |
| 14 tracks | 79–81% → 82–83% | 76–78% → 84–86% |
The ranges cover the three energy curves.
On key and tempo, the look-ahead method does better at every pool size. With a 40-track pool it made every transition compatible on both key and tempo. But that's not the main thing the table says.
The real lesson: the pool matters more than the algorithm
Read the table by row, not by column. With a 40-track pool, both methods make 96% or more of transitions compatible. With a 14-track pool, both sit around 80%; even the better method leaves 17–18% of transitions incompatible.
The reason is simple: if you have 14 tracks for a 12-track set, you have almost no choice. Nearly every track has to go in, including the one whose key fits nothing else. No sorting method can create a track that isn't in the pool.
At 40 tracks it flips: there's plenty to choose from, and a next track that fits is almost always there.
This is one DJ's library, in one genre; in other genres and libraries the numbers may differ. But the direction is clear: in this library, preparing with about three times as many tracks as the set needs delivered the large majority of compatible transitions on its own, whichever method did the sorting.
Leaving a track out
There's another side to this: in a small pool, trying to fit every track into the set lowers compatibility. Sometimes the right move is to take a track out of tonight's set.
That isn't a loss. The track will find its place in another set, next to other neighbours. If there's a track you really want to play, add tracks to the pool that can surround it: the same key, one step away, or the letter switch. You'll find every key's neighbours on our key pages.
How this looks in Harmoniq
Harmoniq's set builder writes an assessment between every two tracks you put in order: both keys, the tempo difference, the energies and how smooth the transition is. When you order a set by hand, you can see which transition is weak. There is also automatic sorting, and today it is based on the greedy method above. We ran this measurement to improve it; the first column of the table shows today's behaviour.
The keys themselves are an estimate too. When Harmoniq isn't sure about a track's key it says so; our confidence score post explains what that means. A set order is only as solid as the keys it's built on.
In short
- Key first, then tempo, then energy: key is a line, tempo is a range, energy is the shape of the set.
- Greedy sorting is fast but can paint itself into a corner; look-ahead sorting did better on key and tempo at every pool size we measured.
- The real difference is the pool: for a 12-track set, a 40-track pool made 96% or more of transitions compatible; a 14-track pool, about 80%.
- In a small pool, squeezing every track in lowers compatibility; leaving a track out is an option too.
- These numbers come from one DJ's house library; yours may differ.
If you want to see the key, tempo and energy of your own tracks, just drop them into the app. The analysis runs in your browser; no file is uploaded.