Hello
I would like your feedback on this. I haven't found software that does this, but i think it can make a huge improvement to the array of available tracks and it may also help avoiding key-lock (sound detoriation).
I requested an article about this as well, but i can well imagine that would require a more elaborate explanation.
Quick introduction after the fact: I'm Bob, I've been djing for techno/electro/house on and off the last 15+ years, and lately I'm just mixing at home having fun with traktor's keymatching assistance.
The outlines are currently to be found here: https://bitbucket.org/hoovebobvan/next-track
N100_BPM - Tempo based key normalization
Assumed is familiarity with: djing, dj software, musical keys, the circle of fifths, some leftover high-school math
this is a first draft
The basic idea
Given 2 tracks that have compatible keys **after** you have pitched them to have to same tempo, you can change the common tempo and they will still sound key-wise compatible.
Based on that principle, it may be useful to calculate keys relative to a norm BPM rather than it's actual bpm. This will yield more results than searching the current tempo for compatible keys.
The name N100_BMP reflects that 100 bpm is chosen as norm tempo, and that the normalized keys are relative to that tempo.
How it works
The following example demonstrates how tempo change relates to note-distance.
Beatmatching: tempo change -> pitch change
When a dj transitions one of the common approaches is to do beatmatching. Most songs have different tempo's, in order to beatmatch dj / his software has to change tempo's for the beats to align.
Changing tempo of a song also changes it's pitch. That means that the root note of the song will change, and so will it's key. Here's s small example
Example: +3.00 pitch
What happens if you pitch a song +3.00 percent in order to get the beats aligned? How does that affect the pitch?
Code:
````{.console}
>>> import os, math
>>> delta_per_cent = 1.0 / 100
>>> delta_pitch_factor = 1.0 + 3.0 * delta_per_cent
>>> delta_pitch_factor
1.03
````
Now we have a pitch factor. Factors are linear. Note distances, when expressed as frequencies, are not linear: the base frequency of the next octave is always a doubling of it's predecessor.
Assuming [equal temperament](http://en.wikipedia.org/wiki/Equal_temperament) we can use the semitone factor to calculate semitone change relative to the tempo factor
Code:
````{.console}
>>> def get_semitone_factor():
... # in equal temperament, the semitone steps all have the same
... # factor to the next semitone
... return 2.0**(1.0 / 12.0)
...
>>> semitone_factor = get_semitone_factor()
>>> semitone_factor
1.0594630943592953
>>>
>>> delta_semitone = math.log(delta_pitch_factor, semitone_factor)
>>> delta_semitone
0.5117320489019243
>>>
````
Normalizing to 100_BPM
The same maths apply. So given a tracks tempo factor to 100 BPM, you can also calculate it's root note at that tempo. This root note will be on a continuum, they don't adhere to A4 = 440hz. Hence the term float_note
Code:
````{.py}
def normalize(self):
factor = 100.0 / self.bpm
normalized = PitchedKey(self.common_key, tempo_factor=factor)
return normalized
````
````{.py}
offset_in_semitones = (
math.log(tempo_factor, semitone_factor))
origin_root_note_as_float = float(key12.root_note.number)
float_note = (
(origin_root_note_as_float + offset_in_semitones)
% DODECA
)
````
## How to use it
After normalizing you use the same principle from the circle of fifths to find matching keys. Note distances to check out are plus or minus 7 semitones, in some cases plus or minus 2 semitones. In order to find these notes quickly, some indexing may be necessary. As simple range 120 based index may suffice to find tracks that are on the same semitone-offset band at a favorable distance. The semitone offset band could simply be defined as the the range 120 based index % 10.
*this is a work in progress, more to follow*
Bookmarks