Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading lyrics information from a .kar file

Tags:

c#

midi

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:

  1. What is the file format of .kar files?
  2. How can I extract the lyrics from .kar files? I don't need to play the audio.
like image 661
stighy Avatar asked Oct 22 '11 14:10

stighy


2 Answers

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.

like image 66
Nik Reiman Avatar answered Sep 20 '22 04:09

Nik Reiman


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.

like image 45
Vilx- Avatar answered Sep 19 '22 04:09

Vilx-