How to detect Musical keys such as (c,d,e,f,c# etc) from audio using librosa ?

770 views
Skip to first unread message

Prashant Kumar

unread,
May 18, 2016, 1:47:21 PM5/18/16
to librosa
Is there any class to detect keys in a audio file ?

Brian McFee

unread,
May 19, 2016, 9:13:16 AM5/19/16
to librosa
librosa does not currently have a key detection model.

However, it ought to be easy to implement a simple model using the pre-computed features at https://www.ee.columbia.edu/~dpwe/e4896/practicals.html#prac10 along with the key labels available at http://isophonics.org/content/reference-annotations-beatles .

Rafael Valle

unread,
May 19, 2016, 8:53:25 PM5/19/16
to librosa

Brian, 
while at labrosa last summer I implemented key detection algorithms, including these ones in the literature:
  1. Krumhansl, C. "Cognitive Foundations of Musical Pitch, ch. 4" (and Schmucker)
  2. Madsen, S. T. and Widmer, G. "Key-Finding With Interval Profiles"
  3. Temperley, David. "A Bayesian key-finding model."
I've been planning to do a pull-request but wanted to check with you first if this is of interest to librosa. 
Please let me know!

Brian McFee

unread,
May 19, 2016, 10:37:44 PM5/19/16
to librosa
Rafael,

That sounds great. Maybe start an issue on github and we can discuss in more detail?

Generally speaking, I'd like to avoid adding functionality that has strong statistical dependencies on specific data sets. If any of those key detection models so require fitting to specific data, they'd be better done as addon/contributed modules.

Reply all
Reply to author
Forward
0 new messages