# Best practice to store level data in a rhythm based game

Setup:

I'm planing to do a rhythm based game, where a level is a music score similar to Frets on Fire, but with real music.

I've two options to store that level data, namely a MIDI file and a MusicML file.

It seems that the defacto standard is MIDI files (see Sintesia, for instance).

I don't need to output that data to the audio system, since is only to build the gameplay, since the player will be the one that will produce the sounds with an external device.

Question:

I wonder, since MusicML is more structured and easy to interact to, if it would be best to store the level data as a MusicML file.

Well, either one of them can be authored with existing tools, which is always a good thing. When I was making a rhythm game, I determined that it would be easier for me to just make my own format with only what I needed and no more. I actually did my transcription with Audacity label tracks, and wrote a Lua script to convert it to a Lua table that I could directly load into my game.

    [27] = {
["starts_new_line"] = false,
["word"] = "the",
["pitch_envelope"] = {
[1] = {
["time"] = 13.662976,
["pitch"] = "C4",
},
[2] = {
["time"] = 13.761109,
["pitch"] = "C4",
},
},
},
[28] = {
["starts_new_line"] = false,
["word"] = "sound",
["pitch_envelope"] = {
[1] = {
["time"] = 13.829461,
["pitch"] = "B3",
},
[2] = {
["time"] = 14.24,
["pitch"] = "B3",
},
},
},
[29] = {
["starts_new_line"] = false,
["word"] = "of",
["pitch_envelope"] = {
[1] = {
["time"] = 14.290176,
["pitch"] = "A3",
},
[2] = {
["time"] = 14.636709,
["pitch"] = "A3",
},
},
}


I know this doesn't really answer your question, I just wanted to demonstrate the possibilities of rolling your own.

• Well, that answer my question to some extent, since what you recommends (rolling my own format) it would be roughly equivalent to use "whatever I feel comfortable with and gets the job done". – diosney Feb 26 '16 at 17:07