I need to only read lyrics from a .kar file.
The problem is that there is a lack of documentation about this in the MIDI standard and .kar documentation.
I tried to open the file with a hexadecimal editor but I didn't understand a lot of things.
So my questions are:
A KAR file is a regular MIDI file (specifically a type 1 file with multiple instruments), except that the way that lyrics are stored varies slightly from regular MIDI files. It's been awhile since I worked with KAR, but IIRC the lyrics are stored as meta text events (type 0x01) instead of lyrics events (type 0x05). However, KAR also uses text events for the title/artist/etc, though those are generally prefixed with an '@' character.
As @Vilx- noted, you can parse KAR in the same way as regular MIDI, so when you are doing so you can simply dump all the meta events and you will see how they are constructed.
I don't have an answer, but I can point you in the direction I would take myself.
A MIDI file's format is pretty well standardized and documented. Wikipedia does not give a link to it, but I remember finding it on the net a good 10 years ago (before even Google was born!), so I don't expect you'll have problems in locating it today.
The format is "chunked", which means that the Karaoke information is most likely stored in a special kind of chunk. The rest is reverse-engineering. Take a karaoke file (.kar, as I understand, is a .mid with lyrics chunks), discard the known chunks and you'll soon find the lyrics chunks. The information in there should not be too hard to decypher.
Added: Also, it is said that KMid supports them, so its source code could shed some light.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With