Skip to content

davidgiffin/libKeyFinder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libKeyFinder can be used to estimate the musical key of digital recordings.

It is the basis of the KeyFinder GUI app, which is available as a binary download for Mac OSX and Windows at www.ibrahimshaath.co.uk/keyfinder

For the most basic use case, do something like this:

static KeyFinder::KeyFinder k;                         // static because it retains useful resources

KeyFinder::Parameters p;                               // it's usually best to use the default parameters
p.setHopSize(8192);                                    // but you can change stuff if you want

KeyFinder::AudioData a;                                // build an empty audio object

a.setFrameRate(yourAudioBuffer.framerate);             // for best results downsample your audio to 4410 Hz
a.setChannels(yourAudioBuffer.channels);               // KF will reduce to mono if you don't
a.addToSampleCount(yourAudioBuffer.length);            // prepare sufficient space in the audio object

while (int i = 0; i < yourAudioBuffer.length; i++) {
  a.setSample(i, yourAudioBuffer[i]);                  // copy your audio into the object
}

KeyFinder::KeyDetectionResult r =  k.findKey(a, p);    // run the analysis

doSomethingWith(r.globalKeyEstimate);                  // and do something with the result!

About

Musical key detection for digital audio, GPL v3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published