Picard: AcousticBrainz & Music Key

Ey-up… I’ve sorted my music collection with Picard very well.

But my housemate has a massive collection for DJ-ing, and while I can sort them bitrate, bpm and key - the musical key seems to have different notations.

There’s standard musical keys, camelot keys and openkeys.

I’ve found no automation for this - and I have no idea how to write a script to compare various inputs (24) and convert to a different output. (24)

As per this https://www.reddit.com/r/MusicBrainz/comments/ttkhbr/changing_key_formats/ - I’m not chasing a total solution.

But advice on a better first step than manual editing - or an example of a simpilar script I can frankenstein?? :smiley:

1 Like

Am I understanding this correctly? You want to be able to have a function to take an input of 12B or 5d for example and return E Major?

1 Like

Yes… the DJ doesn’t get musical principles but ie 12B Camelot he does. There’s just so many so take E Major & or C Minor and return correct Camelot key. His file organisation is an absolute horror show. I have no idea how to make a script look up 24 variables in pairs. Maybe I could search an replace one key at a time across the whole collect.

Seach for in key/initialkey field C# and replace with 8B?

Might work. will try later.

Any other suggestions VERY welcome

Definitly sounds like it might be better done in a plugin. I can take a look at developing one in the next couple of days. I envision it providing 6 functions:

  • camelot2open(camelot_value) → open_value
  • camelot2standard(camelot_value) → standard_value
  • open2camelot(open_value) → camelot_value
  • open2standard(open_value) → standard_value
  • standard2camelot(standard_value) → camelot_value
  • standard2open(standard_value) → open_value

This should cover all use cases. What do you think?

3 Likes

Wow. That’s above and beyond what I need - but would absolutely be useful to any aspiring DJ and their ‘key’ system of choice.

Logically. Yes there are 3 systems out there. So two possible conversions from each system. Your suggestion parses that correctly. But understanding and the skill are not the same thing.

I found nothing online comparable.

If it really is possible - please accept these internet :beer: :beers:

1 Like

I am not familiar with the openkey or camelot notation, but can the format be detected? If yes I think functions to convert to the wanted format but accepting any format would be useful. Especially for cleaning up files that have varying notations and where you don’t know the format being used

Fabulous idea! Yes, it should be fairly easily do-able. Thanks for the suggestion. That should narrow the functions to 3:

  • key2camelot(any_key_format) → camelot_format
  • key2open(any_key_format_ → open_format
  • key2standard(any_key_format) → standard_format
1 Like

Only things I’ve noted between this info graphic here https://www.reddit.com/r/DJs/comments/4c1i64/combined_camelot_and_open_key_notation_wheel/

Is that C# is C Major and C is C Minor if that helps? For the basic codes there’s no overlaps if that helps?

https://mixedinkey.com/ - software uses Camelot keys, but it takes an age to process files and there’s thousands here. Some of which are Standard, the rest are Camelot https://www.beatunes.com for example uses OpenKey. It’s for the non-musically trained just to read up and down numbers

Example
Standard C Major = C#
Camelot C Major = 12
OpenKey C Major = 1d

Tbh not sure what ‘accepting any format’ means, but I could do a table for all 36 possible entries tomorrow if that’s useful as they are all unique?

Just that you could supply any of the formats – C#, 8B or 1d – and it would return the value in the requested format.

I’ll try to pull the information from this key wheel for my initial design, and we can clean it up from there. Thanks.

3 Likes

@MingTheMirthless, I have completed my initial version of the plugin. I haven’t submitted it yet to the official Picard plugins, but if you want to try out the pre-release version you can download it from my repository on GitHub. The download link will send the plugin in a zip file, which you can then install manually from the ‘Options’ → ‘Plugins’ page in Picard. If you do try it out, I would appreciate any comments you might have from a user’s perspective. Thanks.

4 Likes

Amazing. Once I’ve done the morning domestics I’ll parse it over a few of the smaller folders and let you know. :beers: :beer:

2 Likes

Well it’s giving me a blank key field. Have I parsed this correctly? I’m assuming my error.

$set(key, $key2camelot(key))

The function will return an empty value if it failed to detect the proper format (which is useful I think, because in advanced scripts it allows one to detect or remove invalid values). Also in your case you are not passing it the value of the key variable, but literally “key” :wink: To access the value of a variable enclose it in percentage signs.

I would suggest using the function like this:

$set(key,$if2($key2camelot(%key%),%key%))

The $if2 ensures the original value is used if $key2camelot fails to parse the value and returns empty.

2 Likes

Hmm. There’s definitely a needed between (key,$if2($… for any action to happen. It just returns the input

Given input of C C# A# and G# for the files I’ve tried testing on I’m just getting an output field of single <.space> character with my script, or return of original field with second $if2 option.

I’ll help with whatever else. I still hope it’s my error.

$set(key, $if2($key2camelot(key),%key%)) - returns original field but adds an extra <.space> to start of field on every run… ie G#, <.space>G# them <.space><.space> G#

I wish I could help more with what I’m doing wrong here.

Not $key2camelot(key), you need to use percentage signs to access a variable’s value: $key2camelot(%key%).

You have a space between the comma and $key2camelot, remove that.

Nothing happens without that space. At all. With either syntax? Field is left unchanged.

That’s because the key value entered doesn’t match any of the standard inputs. For example, G# should perhaps be entered as A-Flat or A♭ and include a Major or Minor specifier so that it matches one of the entries on the notation wheel that I used for the mapping entries. As an absolute minimum, the Major or Minor specifier is required when entering a key in “standard” format.

Ah… that’s what I was trying to explain earlier poorly.

I’ve just added in they 2OpenKey and can convert 2Camelot and back with each. So this is working correctly.

Your work is 100% correct. I should have tested that. My bad.

Thanks for your patience.

However all the ‘standard key’ files I’ve found so far use only C/C# or Gm/G# for example - not a single one is written in long form, there’s even an Abm I’ve found (A-Flat Minor I think).

Not being a musician myself I’ve used some google-fu & sadly in an attempt to answer your question I found this infographic. It looks like these files have been key’d by traktor at some point.

There’s potentionaly some crossover with inputs and outputs (C#m & Dbm for example musically apparently they are the same(?))

[http://www.quanta.com.br/wp-content/uploads/2013/07/traktor-key-wheel_alta.jpg](https://Traktor Harmonic Wheel Codes)

FYI It is also this ‘key notation’ format that Audiobrainz tags files with in it’s extended key forms on some of my personal files.

All the standard keys only have this 1/2/3 char option where-ever they came from.

Is it still possible to proceed?

I can look at automatically remapping to try to match to the standard input format, but I’ll have to do some reaseach on this first because I’m not a musician either. For example, is C the same as C Major?

As for the values returned from AcousticBrainz, I have no idea. Again, I’ll need to do some additional research.

1 Like

That chart appears to be OpenKey to Standard Key Notation. So converting across the three charts I have there is as follows:

Camelot, OpenKey, Standard Key

8B, 1d, C
9B, 2d, G
10B, 3d, D
11B, 4d, A
12B, 5d, E
1B, 6d, B
2B, 7d, F#
3B, 8d, C#
4B, 9d, G#
5B, 1d, D#
6B, 11d, A#
7B, 12d, F

8A, 1m, Am
9A, 2m, Em
10A, 3m, Bm
11A, 4m, F#m or Gbm
12A, 5m, C#m or Dbm
1A, 6m, G#m or Abm
2A, 7m, D#m or Ebm
3A, 8m, A#m or Bdm
4A, 9m, Fm
5A, 10m, Cm
6A, 11m, Gm
7A, 12m, Dm    
3 Likes