New open source key detection tool

Home :: General Discussion :: New open source key detection toolReply
New open source key detection tool
Posted on: 30.09.2011 by Kari Spindel
Hey all,

I just finished a computer science course and built a key detection tool for DJs as my final project. The tool is called KeyFinder. It's designed to work primarily with EDM, but it's highly tweakable and I've had decent results with various genres.

In addition to a batch key detection interface which can write to metadata tags, it includes a musical visualisation tool called a chromagram. I've found this quite useful for visualising chord structures, melodies and key changes, and I believe it's pretty unique in the DJ software world; I haven't seen any other tools that have something similar.

I got good accuracy during my experiments but unfortunately I didn't test it on a wide selection of music. I had very little time and had to key it all manually and then get the results verified. It would be great to improve KeyFinder to work on a wide variety of genres.

So I'm releasing it for free under the GPL, in the hope the community finds it useful. It's a bit primitive, and for Mac only at present, but it should be pretty simple to port to Windows if there's interest.

If you want to try it you can download a Mac binary here. My write-up which describes the algorithms is also there if you're into that kind of thing. If anyone has any interest in working on it, or any comments or questions, feel free to get in touch here or using the email address on that page.

Cheers
robin loo
20.03.2012
2012-03-20 10:24:04.682 Debug: Decoding /Volumes/derjo/Downloads/KLRGRM - Rankin.mp3 (s16, 44100)
2012-03-20 10:24:04.699 Debug: Decoding /Volumes/derjo/Downloads/Goth Trad-Cut End.mp3 (s16, 44100)
2012-03-20 10:24:04.815 Debug: Decoding /Volumes/derjo/Downloads/Torqux - Bass Association - Far Too Loud (Torqux Refix).mp3 (s16, 44100)
2012-03-20 10:24:04.824 Debug: Decoding /Volumes/derjo/Downloads/KLRGRM_-_KillerCo.mp3 (s16, 44100)
2012-03-20 10:24:10.879 Debug: Decoding /Volumes/derjo/Downloads/Terrible Twos by Direktor.mp3 (s16, 44100)
2012-03-20 10:24:12.119 Debug: Decoding /Volumes/derjo/Downloads/Skeet Skeet & Hype Jones - Hold Up (Back From The Future Remix).mp3 (s16, 44100)


KLRGRM_-_KillerCo is the on where itunes doesnt show anything in the comment field.
Kari Spindel
20.03.2012
On Windows, it's in the same directory as the executable, on Mac it's ~/Library/Logs/KeyFinder.log

Just paste the lines from the bottom of the file that have today's date.
robin loo
20.03.2012
how do i get a log file? i just analysed 6 tracks. all of them show the detected key but one of them didnt write the tag into the comment field
Kari Spindel
20.03.2012
@ weltraumpapst; I very much doubt it's random =) can you provide more detail? A screenshot, what the keyfinder log says about those tracks?
robin loo
20.03.2012
i have the problem that if i analyse liek 20-40 tracks at once some (randomly) dont get tagged
Kari Spindel
20.03.2012
Alright, thanks for trying. Best thing now is probably for you to email/upload a zip with, say, 5 of these files in (make it representative, e.g. if you're having the same problem with multiple formats, make sure they're all in there) and I'll take a closer look. Hopefully it's easily fixed but I've not come across this before. Also version numbers for OS/iTunes/KF please.
Halley Wurzer
19.03.2012
Hey ibsh,
Thanks for the reply, just tried deleting a track from my lib and bringing it back in, no dice with getting the key comment to show. Here is a more updated/detailed description of my problem: http://community .djranking s.com/showthread.php?t=48747
Thanks for the help man.
Kari Spindel
16.03.2012
Hey SB, sorry, I only just saw this message.
Glad you figured most of it out on your own.

As for iTunes... that's a little bizarre, but iTunes is a total headache when it comes to tags.

Just for an experiment, what happens if you remove one of these files from your library completely, and then drag it back in so that iTunes has to re-read it?

Also, iTunes used to have a function called "Convert ID3 tags" that I used to have to use a lot back in the Final Scratch days (yes, I'm old ). Is it still there? Running that also ought to force iTunes to re-read the file's metadata.
Halley Wurzer
12.03.2012
Hey ibsh,

I really appreciate you making this software available to us! I have a quick question, I can't seem to get it to actually write the key tags. In your application, it looks as if the tags are written but they do not show up in Traktor or iTunes, it doesn't change the comment / key fields. My preferences look like:Screen Shot 2012-03-12 at 8.48.02 PM.jpg What am I doing wrong? Also, once I get it figured out and my library key tagged, Traktor won't have to reanalyze my tracks will it?

Thanks,
Sam

Edit: If I right click on the track file (in finder) and get info, the key does show up in the comments there, it just doesn't show up in iTunes or Traktor.

Edit 2: After doing check consistency, the keys all show up in the comment field as they should in the Traktor track collection. With some exceptions, they do not show up in the iTunes trees though, which is what I use to organize my music. Back in iTunes, the exceptions are about 350 of 3900 tracks. Screen Shot 2012-03-13 at 10.01.56 AM.jpg If I hit play on a track that has some sort of text in its comment field, it refreshes to show the key as it should. As most of my tracks had nothing in comments, and adding something then playing the track doesn't work, I can't figure out how to get the key to display for the rest of my library. Ive tried selecting all tracks and editing the composer just to get iTunes to recognize change (as I would to get BPM value to display in iTunes after analyzing in Traktor), keys still don't show in comments where they should. The first edit remains true for all files I checked in finder so I know the key values have been written.Screen Shot 2012-03-13 at 10.04.33 AM.png
Random X
12.03.2012
Thanks once again ibsh!
Kari Spindel
12.03.2012
It writes results to the file tags as usual. You'll need to refresh stuff in Traktor to see them. Didn't want to screw up anyone's library. =)
DJ MENSAH
12.03.2012
Ah, thanks for updating us passive users. Does is write the key info back to Traktor library or it is read-only interaction?
Kari Spindel
11.03.2012
Good morning sir, good afternoon madam, good evening all, how d'you do?

Any existing users should get an automatic notification, but here nonetheless is KeyFinder v1.13, which you can get from my site as usual.

Features include:
* Automatic library integration with Serato, Traktor and iTunes (you can specify file paths in Preferences)
* The ability to remove rows from the drag and drop list, either with the Delete key or right-click menu

Beware: loading even short playlists from a large iTunes library can take a while. You may want to use other methods. But I thought I'd include it for the sake of completeness.

Feedback welcome as always.
Kari Spindel
18.02.2012
Back once again with the expected behaviour is KeyFinder v1.11, which you can get here.

Features include:
* Mac OS 10.5 support (at least on Core 2 Duo)
* automatic update notification
* support for higher bit-depth (24-bit/32-bit) audio files
* fixed a segfault that was crashing the Windows build
* improved decoding for most Windows Media file formats
* proper logging solution on Windows
* improved memory management, greater stability
* drag and drop from Serato and Traktor (OK, that was in there before but I didn't realise it...)

Feedback welcome as always, especially if you've been waiting for the Leopard build; let me know how you get on. Is it working on Core Duo machines now?
Kari Spindel
08.02.2012
@ToOntown

Glad it's working out for you. Unfortunately there's no support in KF for writing to the Album tag. I believe most users will already have data in there for a lot of tracks and I'd rather not clutter up the interface with it; hope that's not too disappointing.

@weltraumpapst

There's currently a link in my "What's New" section to my own comparison data. It's incredibly limited, as it only covers 100 tracks, but it gives a decent ballpark.
robin loo
07.02.2012
did you or someone did a comparison between your program and Mik 4, 5, RE or beatport?
i just compared a few with MiK 4, where all the keys where the same..
Shonda Soulier
07.02.2012
Looks like it's working well for me. Going to donate for sure.

One thing I would like to know...is there support for writing to the "Album" field of a tag?
Random X
08.02.2012
Anytime bro', big up for sharing your project with us.

(By the way, did you see the promotion on digitaldjtips as well? )
Kari Spindel
07.02.2012
@nnimieyd

I can't see any of your embedded images mate. Could you try to reupload them? Or maybe just describe the problem in words?

I assume from the little information I have that the file returned "Could not decode"? If that's the case, and it can't be analysed in Traktor, and you got it off a filesharing site, I'd bet it's corrupted in some way.

If, on the other hand, this caused a crash, please give me some details (OS version and KF version at least), and if you can email me the track (there's a link on my site) that would be ideal.

Cheers
ibsh
robin loo
06.02.2012
nice, that you have a new version up..
Kari Spindel
06.02.2012
Cool tekki, thanks for the promotion =)
Random X
06.02.2012
Thanks man, this got your second entry on my blog, within two weeks.
Kari Spindel
05.02.2012
Today I'm releasing KeyFinder version 1.1.9.
Features include:
* GUI enhancements including live tag updating and simpler Preferences window
* option to write to multiple tags
* option to skip files where tags already populated
* parallel (faster) metadata reading for big batch jobs
* use of keycodes in detailed analysis window
* support for Japanese charsets (on the Mac, at least)
* CLI (sort of) and drop-to-dock-icon (Mac)
* all kinds of bug fixes

And this version brings Windows into line with the Mac release, feature wise. I'm sure there are still bugs to iron out but I believe it should be more stable now.

Feedback welcome as always. Enjoy.
Alvera Farrelly
29.01.2012
looking forward to check it out in the next couple of days
Rosina Steinkuehler
29.01.2012
Nice work!
Sammie Filetti
29.01.2012
All right!
Will try it out for the first time toevening , thanks for being awesome!
Kari Spindel
29.01.2012
New version 1.1.8 is now available, featuring:
* more stable multicore performance
* the option to disable parallel processing, to reduce CPU load
* support for iTunes XML libraries and playlists
* boring bug fixes.

Shout if you have any question, problems, feature requests.
This update is Mac only at present, apologies to Windows heads.
Kari Spindel
30.12.2011
A new release is available, including:

* Multicore support (thanks GeekGod ). Batch jobs should now be much faster, though your CPU fan may get a little noisy.
* Fix for handling of Comment tags on FLAC files (not an issue for Serato users, obv).

Next priorities:
* Get a 32-bit Mac build working
* One day, fix the Windows build

As ever, shout if you have any issues. And if any interested devs are lurking, I could use some help with the Windows build.
Kari Spindel
10.12.2011
I've thought about it, but I really couldn't say. The computation is already pretty strongly multi-threaded, so I suppose multi-core might be simpler than otherwise. But I don't know much about the processes or challenges involved. Interested to learn though. Might begin research over the holidays.
Rosina Steinkuehler
10.12.2011
This seems to work rather well. Can you add multi-core support to your laundry list or is that going to be a lot of work?
Kari Spindel
10.12.2011
Ok cool; doesn't seem necessary then! It's probably just a metadata version problem as you say.
Bethany Adrianzen
11.12.2011
Originally Posted by ibsh
newg, could you email me an audio file demonstrating that behaviour?

Actually, the best thing would be two copies of the file; before and after.

I don't know what's causing the bug you describe, but that would def help me to get to the bottom of it.

Cheers
ibsh
ibsh, please ignore my last comment. your software seems to be working great.

I remarked on this after the tags disappeared in windows explorer (they still are).

However, the edited tags are completely visible in foobar2000 and in Serato, so the windows issue is pretty much a non-issue. it's most likely just a windows incompatibility with the ID3 tag version your software uses.

if you'd like me to email you an analysed file, i can still do so, let me know.


EDIT: I'm runing the system file check detailed in this post right now, so i'll see if this makes a difference
Kari Spindel
10.12.2011
newg, could you email me an audio file demonstrating that behaviour?

Actually, the best thing would be two copies of the file; before and after.

I don't know what's causing the bug you describe, but that would def help me to get to the bottom of it.

Cheers
ibsh
Bethany Adrianzen
10.12.2011
Just trialling your windows build and it seems to work perfectly for me in all areas but one.

Detects keys perfectly, and has taken my custom key codes no problem, and the keys detected seem to be correct.

Only problem is trying to write this discovered information to the tags. writing the key data to tags (I've selected my key codes as the preffered)

doing this erases all information in the tag, including artist, album, year, etc. Essentially it blanks the tag.

once this seemingly small isuue is fixed, I'd happily dump RE for your tool, RE gives me nothing but problems, and this just seems to work much better.

shows promise!
Golden Faubert
10.12.2011
ill be all over it when its ready for windows. good work mate.
Golden Faubert
10.12.2011
Originally Posted by ibsh
You can add your own custom codes into KF though, obviously.
haha i like this
Kari Spindel
10.12.2011
Another minor release for you, including:

* Option to write to tags automatically (check the box in Preferences>Tags)
* Support for UTF-8 filenames
* Bug fixes including some M3U problems
* I stripped out all the crap algorithms now that my project's been marked!

Next priorities:
* Get a 32-bit Mac build working
* One day, fix the Windows build
* iTunes XML support (meh)

Enjoy!
Khadijah Wojtach
21.11.2011
Originally Posted by happydan
You're talking about patents. Copyright is about the design [of the Camelot wheel].
Thanks for clearing that up. US copyright and patent laws gives me a headache

Still, it is really a problem?
Evalyn Voges
20.11.2011
Originally Posted by decon
Awesome. I'll be following your project, hopefully your software will get a proper Win 7 version and camelot coding. As Mil0, I too find it weird that MiK as copyright on letters? It's like getting copyright on converting 'a' into '1' or 'b' into '2'. Surely the copyrights laws are that messed up (properly are, but one can hope).
You're talking about patents. Copyright is about the design [of the Camelot wheel].
Kari Spindel
20.11.2011
KF won't be getting Camelot coding: I spoke to MIK just recently, they're not doing freeware licenses any more. You can add your own custom codes into KF though, obviously.

As for how messed up the intellectual property rules are... no comment =)

<< Back to General DiscussionReply

Copyright 2012-2023
DJRANKINGS.ORG n.g.o.
Chuo-ku, Osaka, Japan

Created by Ajaxel CMS

Terms & Privacy