trouble implementing game feature

I am having a lot of trouble implementing a new feature for my game. First, some background: I have a karaoke game…
http://singthegame.com
In the game players sing into mics, the game does pitch detection, and scores them by comparing their pitch to the original artist. To play the game you need a song file (MP3, etc) and also a note file. The note file is created by the “Note Editor” that comes with the game.

Currently there is a “song” directory and a “notes” directory. To play the game with a song, you need to have a note file for that song and place it in the “notes” directory. Then you need to place the song file into the “songs” directory and name it exactly like the note file (except for file extension). Eg:

notes/Michael Jackson - Don’t Stop 'till You Get Enough.notes
songs/Michael Jackson - Don’t Stop 'till You Get Enough.mp3

Simple right? Well, simple to code, and simple for computer savvy users. Most users have a lot of problems with this approach:

  1. After they download the game, if they run it without copying and renaming their music, the game has no song files and so they can’t play right away, they have to figure out what to do. I have some brief messages explaining what to do, but people still get stuck.

  2. Some people can’t figure out how to copy files around. Some users don’t know where their music is (eg, “it is inside iTunes right!”).

  3. If they do get as far as copying their song files to the “songs” directory, they often are unable to name the song files exactly like the note files. I’m guessing they don’t use copy and paste. Currently the game requires the file names to be identical, except for case.

  4. If they do figure it all out, they generally don’t like keeping their music in two places on their computer.

So that is my problem. I want users to be able to point the game at their music folder(s) and have it automatically match song files to note files. This way I can build a wizard so when the game is first run, it helps them choose their music folder, then they can immediately play the game with songs that match. If the auto matching doesn’t match or matches wrong, I guess I need a tool where users can manually match songs to note files.

I have started building this using Lucene. I index all the note files (which are named “Artist - Song Name.notes”), then I do a search with each song file (which could be named anything!). I don’t have auto matching yet, but it would just pick the top result. Right now it just suggests note files. It looks like this so far…

http://singthegame.com/misc/org.gif

This has a few issues.

  1. I’m not sure if the workflow should be “pick a song, add note files to it” or “pick a note file, add it to a song”. I went with the former because a song can have multiple note files (eg, for a duet, or one for lead vocal, one for chorus, etc). I could try to make a UI that can go either way, but that can get complicated. I do want to try to avoid showing note files assigned to a song by selecting them in the main note file list because I would have to allow multi select and with such a big list (300+) it won’t be clear if more than one note file is selected without scrolling up and down the whole list.

  2. I’ve played with ways to index and search in Lucene. Eg, if I have the song “Aerosmith - Crazy.mp3” it matches to “Aerosmith - Crazy.notes”. However, “Aerosmith - Carzy.mp3” (misspelling) does not match. If I use fuzzy matching (Levenshtein distance) then it matches, but fuzzy matching causes false positives if I didn’t actually have a “Aerosmith - Crazy.notes” file. I can’t possibly do auto matching with fuzzy turned on.

Do you guys have any input? Can you think of any similar problems you’ve encountered that maybe we can borrow the solution from?

Basically, I just don’t have a clear vision for how to implement this feature. On the surface it seems relatively simple, but when I try to solve it, I just get discouraged. I don’t know if I’m just stressed / depressed / mental, but I’ve tried a few times over the past few weeks and I just can’t get past this problem. I normally program every day, so it is unheard of for me to go over a week without coding, but that has happened multiple times now. There are other things I want to work on for my game, but none are as important as this. I don’t want to move on to other features or other projects without finishing this.

Surely you can do automatching if you choose your fuzz factor so that it allows a Levenshtein distance of no more than 3? That will catch simple typos.

I see what you mean. The problem seems easy, but the details are complicated.

Did you think about getting the ID3 tags of the songs? There could be a lot of additional information in there for you, but it will take a while to fetch the data.
Also, there are tools like MP3tag, which identify a batch of files quickly against freeDB (or other service), if no ID3 tags are available. That mechanism could give you more reliable data.

“pick a song, add note files to it” seems about right. You need the song in any case and maybe it’s easier then to find the notes file for it. It would also limit the need to identify your file. You can guess / fetch id3 data and then have the user correct, if necessary?

AFAIK, Lucene only lets you specify a percentage of the word that must be correct. So with 0.5, card, cars and farm can match but cats and corn (0.25 is correct) cannot. I’ll look into more granular control though. Maybe I could also only allow fuzzy match for words with 4+ or maybe 5+ characters.

One thing that is a pain, how do I test how well my auto matching mechanism works? My music library has all the songs named correctly! So far I have been manually added typos, but I don’t think this really simulates a real user’s library.

Yes, I can read MP3 tags. I’m not sure about reading metadata from other file types though. I haven’t implemented this as part of the search yet. The search should be useful even with no metadata, so I’ll come back and add it later.

I can recommend something like MP3tag to users, but likely they won’t want to download and figure out another program. I google for some open source tagging programs though, maybe there is something useful there.

“pick a song, add note files to it” is good if you want to play the game with a particular song. “pick a note file, add it to a song” may be good if you are going through all the available note files to assign to whatever music you have. I pointed the tool at my wife’s music library (which has almost none of the songs that match note files) and the 200+ song list was overwhelming. I guess, if a user is going to manually match all of their songs to note files, they will want to look through the shorter list. Maybe my tool needs to support going both ways.

I assumed that it specified a minimum amount which must be correct. Not sure quite how you’re using the library, but maybe you can change the factor each time you change the string you’re matching against.

[quote]One thing that is a pain, how do I test how well my auto matching mechanism works? My music library has all the songs named correctly! So far I have been manually added typos, but I don’t think this really simulates a real user’s library.
[/quote]
Throw an HTML parser at the Pirate Bay’s top 100?