从 .kar 文件中读取歌词信息

发布于 2024-12-11 11:57:20 字数 262 浏览 0 评论 0原文

我只需要从 .kar 文件 读取歌词。

问题是 MIDI 标准和 .kar 文档中缺乏关于此的文档。

我尝试用十六进制编辑器打开该文件,但我不明白很多东西。

所以我的问题是:

  1. .kar 文件的文件格式是什么?
  2. 如何从 .kar 文件中提取歌词?我不需要播放音频。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

草莓味的萝莉 2024-12-18 11:57:21

我没有答案,但我可以为你指明我自己的方向。

MIDI 文件的格式已经得到很好的标准化和记录。维基百科没有提供它的链接,但我记得 10 年前就在网上找到了它(甚至在 Google 诞生之前!),所以我不认为你今天找到它会遇到问题。

格式是“分块”的,这意味着卡拉 OK 信息很可能存储在特殊类型的块中。剩下的就是逆向工程。拿一个卡拉 OK 文件(.kar,据我所知,是一个带有歌词块的 .mid),丢弃已知的块,您很快就会找到歌词块。里面的信息应该不会太难破译。

添加:此外,据说 KMid 支持它们,所以它的源代码可以提供一些启示。

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.

凉世弥音 2024-12-18 11:57:21

您可以使用这个免费的 .NET 库:NAudio

You can use this free library for .NET : NAudio

以歌曲疗慰 2024-12-18 11:57:20

KAR 文件是常规 MIDI 文件(特别是具有多种乐器的类型 1 文件),只是歌词的存储方式与常规 MIDI 文件略有不同。自从我使用 KAR 以来已经有一段时间了,但 IIRC 歌词存储为元文本事件(类型 0x01)而不是歌词事件(类型 0x05)。然而,KAR 还使用标题/艺术家/等文本事件,尽管这些事件通常带有“@”字符前缀。

正如 @Vilx- 指出的,您可以像常规 MIDI 一样解析 KAR,因此当您这样做时,您可以简单地转储所有元事件,然后您将看到它们是如何构造的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文