Skip to content

batusai8889/libKeyFinder

 
 

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 because it retains useful resources for repeat use
  static KeyFinder::KeyFinder k;

  // Prepare the default set of parameters
  KeyFinder::Parameters p;

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

  // Prepare the object for your audio stream
  a.setFrameRate(yourAudioStream.framerate);
  a.setChannels(yourAudioStream.channels);
  a.addToSampleCount(yourAudioStream.length);

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

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

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

About

Musical key detection for digital audio, GPL v3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published