Harmonic mixing or key mixing (Also referred to as mixing in key) is a DJ's continuous mix between two pre-recorded tracks that are most often either in the same key, or their keys are relative or in a subdominant or dominant relationship with one another.
The primary goal of harmonic mixing is to create a smooth transition between songs. Songs in the same key do not generate a dissonant tone when mixed. This technique enables DJs to create a harmonious and consonant mashup with any music genre.
A commonly known method of using harmonic mixing is to detect the root key of every music file in the DJ collection by using a piano. The root key that fits the track perfectly may be used to create harmonic mash-ups with other tracks in the same key. The root key is also considered compatible with the subdominant, dominant and relative major/minor keys.
A more advanced harmonic mixing theory has been proposed which accounts for the various modes as well (aeolian, ionian, lydian, mixolydian, dorian and phrygian). It is shown that these alternate modes can be seen as variations of the traditional major and minor keys. The corresponding traditional key will share the same number of sharps and flats as the mode, though it will "feel" as if it's in a different key.
Which notes are in the scale is much more important than which is the tonic, so these can be converted to one mode, such as minor. For example, F lydian and B locrian contain the same notes as A minor, so these should be compatible, and slightly less with D minor and E minor.
Starting in 2006, harmonic mixing experienced a renaissance. Two products made it easier for DJs to analyze the keys of their music files by scanning files and eliminating the need for a piano. Mixed In Key became an industry standard for key detection due to the large number of fans and notable people in the DJ industry using the product. Mixed In Key also uses its own unique system to identify and mix compatible keys called the Camelot Wheel. Freeware utilities for the same purpose include Rapid Evolution by MixShare  and KeyFinder by Ibrahim Sha'ath. Starting with version 2.6.1 Traktor from Native Instruments can also perform key detection. Serato DJ and Scratch Live from Serato, and Torq from M-Audio have a "Key" display in their interfaces, as well as a key column in the library browser to allow for easy sorting of songs by key as does Virtual DJ from Atomix Productions as of version 5.0. Rekordbox from Pioneer also included a key column for sorting music metadata and has a built-in key analyzer that is included with version 2.0.1 and higher. Mixmeister is yet another software that performs automatic key and bpm detection and performs beatmixing automatically and honours harmonic key information at the discretion of the user.