key-tools: Musical key analysis

The key-tools software is used to automatically analyse and tag the key of music files. Its primary use is to help DJs catalog a music library.

The algorithm and its implementation are wholly the work of Ibrahim Sha'ath; code used with permission from his KeyFinder software, reportedly the same as used by the commercial MixVibes CrossDJ. Full credit is given for such excellent software.

The motivation for developing this was to implement key finding in a way improved for scripting only (no GUI) for concurrent analysis and easier integration with xwax, with a simple build process and fewer dependencies. No changes were made to the algorithm itself.

The tools are developed for Linux, though it should be relatively easy to port to BSD or other unix systems. The sister project to this is bpm-tools for tempo (BPM) detection.


$ key-tag "The Brand New Heavies - Sometimes.flac"
The Brand New Heavies - Sometimes.flac: 7A
$ metaflac --show-tag=KEY "The Brand New Heavies - Sometimes.flac"
$ key-tag -t "Frank Hooker and The Positive People - This Feeling.mp3" 
Frank Hooker and The Positive People - This Feeling.mp3: Gm
$ id3v2 -l "Frank Hooker and The Positive People - This Feeling.mp3" 
TKEY (Initial key): Gm
$ find -name '*.flac' -print0 | xargs -0 -n1 -P4 key-tag        # tag a whole library multithreaded

Source code

The most recent release is key-tools 0.1 (2nd August 2013)

There is a Git repository available:

$ git clone

This software is licensed under the GPLv3.


I'm the developer of the Linux DJ software xwax.

Mark Hills
August 2013