Forums » General Discussion Search

Audio Summary - Key Conversion New Reply

Author Post
Posts: 4
Registered: Apr 06, 2012

I am trying to convert the numerical value for the key in the audio summary and was curious if this function would give me the correct key?

http://hastebin.com/texuracubo.coffee

Posts: 161
Registered: Feb 22, 2011

meowsk,

Your function appears to interpret the key values correctly. Your function "detectSongMode" inverts the meaning of the "mode" value, which refers to "minor" (value 0) and "major" (value 1) modality.

You made an interesting choice to spell "mode = 0" keys as sharps (D#, F#, G#, etc.) and "mode = 1" keys as flats (Eb, Gb, Ab, etc.). This is largely editorial, but while A# minor and Bb minor are enharmonic (sonically identical), a music publisher/composer would probably prefer to "spell" the key as Bb minor, avoiding the awkwardness of 7 sharps. The same holds for the relative major keys, preferring Db major over C# major. See A-sharp_minor.

David

Posts: 4
Registered: Apr 06, 2012

Is there a 12 note scale I could use instead of using the major/minor to determine the key? I was using the image below as a reference and the only way it seemed to make sense was using the major/minor to determine if the scale was going up or down (flat or sharp)? My musical theory is a little rusty so my assumptions could be completely wrong.

http://i-love-guitar.com/images/colorkey.gif

Posts: 161
Registered: Feb 22, 2011

meowsk,

For enharmonic keys (e.g. F# and Gb) there is no concept of "going up or down". It's a choice of the composer/publisher how to write the music. Most of the time a publisher will seek to minimize the number of accidentals (sharps and flats) in the key signature, but not always.

We can't determine the original composer's intent and preference from the acoustic data. Sorry!

David

Posts: 4
Registered: Apr 06, 2012

Is there documentation anywhere on how the keys match up with the numbers sent by Echonest?

Posts: 69
Registered: Sep 17, 2008

Yes, C=0, C#=1, etc. See the documentation in the track API.

Posts: 4
Registered: Apr 06, 2012

Thanks for much for that info!

So the only part I am confused about now are the missing values in my function below...

http://hastebin.com/tenuwutevi.pas

I am not sure which one to choose in each set...

3 = D#/E♭ 6 = F#/G♭ 8 = G#/A♭ 10 = A#/B♭

Reply to this Thread

You must log in to post a reply.