Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Lyriclib
Lyrics for any audio source: shows the .lrc of whatever track is playing, floating above the hotbar or in a separate transparent window, TMP native font (LXGW WenKai by default), karaoke-style progressive fill, plus a native FLAC decoder.
By BiliBiliMOXL
| Last updated | 5 days ago |
| Total downloads | 176 |
| Total rating | 0 |
| Categories | Libraries AI Generated |
| Dependency string | BiliBiliMOXL-Lyriclib-2.0.0 |
| Dependants | 1 other package depends on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2305README
Lyriclib 2.0.0
Lyrics for whatever is playing in Lethal Company — a boombox track from a music mod, a radio pushed by another mod, or a single clip somewhere on disk — rendered on screen with karaoke-style progressive fill; no song list to maintain, no fixed provider to hook, plus a native FLAC decoder for music mods. Everything below is collapsed — expand the English or Chinese block to read the full documentation.
BepInEx 5.4.2305 · client-side · no gameplay logic modified
English version README
Features
| Feature | What it does |
|---|---|
| Any-source track detection | Resolves the currently playing track from three independent paths at once: the CustomBoomboxMusic catalog, explicit pushes from other mods, and automatic AudioSource scanning in the scene |
| Drop-in lyrics | A .lrc sitting next to the audio file is used immediately — the song does not need to be registered in any config folder |
| Two overlay modes | HudAboveHotbar floats the text just above the hotbar with no panel; FloatingWindow is a separate transparent UI window you can anchor and nudge |
| Karaoke sweep | Played characters tint towards a highlight colour and advance by glyph width, so mixed CJK/Latin lines keep an even pace |
| Word-level timing | Enhanced LRC <mm:ss.xx> tags are honoured per character; plain LRC stays line-based |
| Native FLAC support | Built-in decoder lets music mods play .flac tracks; the stock behaviour is untouched when disabled |
| Zero-install fonts | A bundled CJK font is loaded process-private (no system install, no registry write) with a graceful fallback chain |
| Public API | Other mods can push playback state, query lyrics, toggle visibility and reuse the FLAC decoder |
| Live config | All settings are read at runtime; editing the cfg does not require a restart |
Installation
-
Install BepInEx 5.4.2305 for Lethal Company (Thunderstore Mod Manager / r2modman installs this dependency automatically).
-
Drop the
BiliBiliMOXL-Lyriclibfolder into your profile's plugin directory:...\LethalCompany\profiles\<your profile>\BepInEx\plugins\ -
Launch the game once.
BepInEx\config\Lyriclib.cfgandBepInEx\config\Lyriclib\lyrics\are created on first run. -
Play a track that has a matching
.lrcand the overlay appears by itself.
No song has to be configured before the first use — step 4 is enough for the common case.
Where lyrics go
Pick any one of the three options below; they can also be combined.
| Option | Example | Notes |
|---|---|---|
| Next to the audio file (recommended) | CustomBoomboxMusic\Song.mp3 + CustomBoomboxMusic\Song.lrc |
Matched by identical file name in the same folder; works for any mod and any folder |
| Shared lyric folder | BepInEx\config\Lyriclib\lyrics\Song.lrc |
Matched by file name, useful when audio files must stay untouched |
Any folder listed in MusicRoots |
see the configuration reference below | The folder is indexed at startup and on config change |
Supported lyric syntax: plain LRC, multiple timestamps per line, metadata tags ([ti:], [ar:], [offset:]) and enhanced per-character LRC. Malformed lines are skipped instead of breaking the whole file.
Configuration reference
Two config files are written on first launch:
| File | Section | Controls |
|---|---|---|
BepInEx\config\Lyriclib.cfg |
1. General |
master switch, source detection, MusicRoots, shared lyric folder |
BepInEx\config\Lyriclib.cfg |
2. Display |
overlay mode, size, line width, offsets, anchor, opacity, sorting order |
BepInEx\config\Lyriclib.cfg |
3. Karaoke |
sweep toggle, played / unplayed colours, sync offset |
BepInEx\config\Lyriclib.cfg |
4. Font |
font family, fallback chain, bundled TTF path |
BepInEx\config\Lyriclib.Flac.cfg |
General |
native FLAC decoding for music mods |
Lyriclib.cfg — [1. General]
| Key | Default | Meaning |
|---|---|---|
Enabled |
true |
Master switch for the lyric overlay |
AutoDetectSources |
true |
Scan AudioSource components in the scene; explicit pushes from other mods take priority |
MinTrackSeconds |
8 |
Clips shorter than this are treated as sound effects and ignored |
MusicRoots |
<plugins>\CustomBoomboxMusic |
Folders indexed for music files, ;-separated; relative paths resolve against the BepInEx root. Defaults to the CustomBoomboxMusic library only — add any other mod folder yourself |
SharedLyricFolder |
config\Lyriclib\lyrics |
Extra folder holding .lrc files named after the song; relative paths resolve against the BepInEx root |
Lyriclib.cfg — [2. Display]
| Key | Default | Meaning |
|---|---|---|
Mode |
HudAboveHotbar |
HudAboveHotbar (text above the hotbar, no panel) or FloatingWindow (separate UI window) |
FontSize |
30 |
Main lyric font size at 1080p |
LineWidth |
1100 |
Maximum width of one lyric line in reference pixels |
OffsetX / OffsetY |
0 / 0 |
Horizontal / vertical nudge in pixels; positive is right / up |
WindowAnchorY |
0.28 |
Vertical anchor of the floating window, 0 = bottom, 1 = top |
BackgroundOpacity |
0 |
Background alpha, 0 = fully transparent |
ShowNextLine |
true |
Show the upcoming line |
ShowTrackTitle |
false |
Show the track title |
SortingOrder |
30000 |
Canvas sorting order, keeps lyrics above the HUD |
HideWhenNotInGame |
true |
Hide outside the ship / facility |
Lyriclib.cfg — [3. Karaoke]
| Key | Default | Meaning |
|---|---|---|
EnableSweep |
true |
Progressive karaoke fill |
PlayedColor |
#FFD24A |
Colour of already-sung text |
UnplayedColor |
#FFFFFF |
Colour of not-yet-sung text |
SyncOffsetSeconds |
0 |
Timeline offset; negative makes lyrics earlier, positive later |
Lyriclib.cfg — [4. Font]
| Key | Default | Meaning |
|---|---|---|
FontFamily |
LXGW WenKai |
Preferred family name; the bundled TTF provides it |
FontFallbacks |
LXGW WenKai Screen;Microsoft YaHei;Noto Sans CJK SC;SimHei |
Fallback chain, ;-separated |
FontFile |
<plugin>\fonts\LXGWWenKai-Regular.ttf |
TTF shipped with the plugin |
FontAssetName |
(empty) | When set, an already-loaded TMP font asset with this name wins |
Lyriclib.Flac.cfg — [General]
| Key | Default | Meaning |
|---|---|---|
Enabled |
true |
Decode .flac (and other formats Unity cannot read) for music mods; false restores stock behaviour |
Notes on MusicRoots
MusicRoots only drives folder indexing. Drop-in .lrc matching and SharedLyricFolder keep working even when the list is empty.
# CustomBoomboxMusic only (2.0.0 default)
MusicRoots = BepInEx\plugins\CustomBoomboxMusic
# Add other mod folders yourself, separated by ';'
MusicRoots = BepInEx\plugins\CustomBoomboxMusic;BepInEx\plugins\SomeOtherMod\Sounds
Track detection
Lyriclib never assumes a single provider. Three resolvers run side by side and the most specific one wins.
| Path | How it works | Used when |
|---|---|---|
| Catalog bridge | Reflects into the CustomBoomboxMusic audio catalog and maps every loaded clip back to its source file | A music-mod player is active and its clips come from the catalog |
| Explicit push | Another mod calls LyriclibApi.PushPlayback(path, time, duration, displayName) every frame; 1.5 s without a push ends the track |
You drive your own audio and want tight sync |
| Scene scanning | Watches AudioSource components in the scene and matches the clip name back to a file on disk |
Music is played by code Lyriclib does not know about |
Track changes are keyed by path + display name, so switching between two sources that have no file path (streams) still reloads lyrics correctly. Lyrics are re-parsed automatically when the .lrc file's timestamp changes.
Fonts
The plugin ships fonts\LXGWWenKai-Regular.ttf (LXGW WenKai, SIL OFL 1.1 — the licence text is bundled as fonts\OFL.txt).
-
The face is loaded process-private via Windows
AddFontResourceExwithFR_PRIVATE. It is not installed system-wide, not written to the registry, and disappears when the game exits — yet Unity and TextMeshPro can use it for the session. -
You do not need LXGW WenKai installed on the machine.
-
If private loading fails on your setup, the plugin falls back in this order:
LXGW WenKai→LXGW WenKai Screen→Microsoft YaHei→Noto Sans CJK SC→SimHei -
Lyrics do not disappear when a fallback is used. The log prints the family actually in use, so you can confirm what happened.
-
Glyphs are generated into dynamic TMP atlases. 2.0 raises the atlas size and enables multi-atlas expansion, so long playlists no longer run out of glyphs.
FLAC
Lyriclib.Flac.cfg → [General] Enabled = true (default) turns on a built-in FLAC decoder.
- Decoding runs off the main thread; the resulting
AudioClipis created on the main thread. - Decoded tracks are registered back into the music mod's catalog, so they behave like any other track (queue, shuffle, metadata).
- Set
Enabled = falseto restore the stock behaviour and keep Lyriclib purely as a lyric overlay. - Other formats Unity cannot decode natively use the same path.
Troubleshooting
| Symptom | What to check |
|---|---|
| No lyrics at all | Search BepInEx\LogOutput.log for [Lyriclib] lines; confirm the file is .lrc and shares the audio file name |
| Lyrics render as boxes | The first CJK glyph build failed. Check the log for bundled font loaded privately and the resolved family name; installing fonts\LXGWWenKai-Regular.ttf manually and restarting always works |
| Lyrics drift out of sync | Adjust SyncOffsetSeconds (negative = earlier, positive = later) or check the [offset:] tag in the LRC |
| Long songs start losing characters | 2.0 enables dynamic multi-atlas generation; if it still happens, attach the log in a bug report |
.flac files do not play |
Confirm [General] Enabled = true in Lyriclib.Flac.cfg and that the music mod has loaded the file |
| Config edits seem ignored | The overlay reads the cfg live, but MusicRoots changes trigger a re-index — wait for the log line confirming the refresh |
| Overlay hidden in menus | Expected: HideWhenNotInGame = true hides it outside the ship and facility |
Upgrading from 1.x
From 1.x
1.x used different key names, so launching 2.0 over an old file leaves both key sets in one cfg. Delete the old Lyriclib.cfg (it is auto-backed up as Lyriclib.cfg.v1.1.0.bak) and let 2.0 generate a clean one.
MusicRoots default value
Since 2.0.0 the default is only BepInEx\plugins\CustomBoomboxMusic; no third-party mod directory is hard-coded anymore.
- New installs: the generated cfg contains the single entry. Append further folders with
;when you need them. - Existing installs: if
MusicRootswas customised (including still holding the old multi-folder value), your current value is kept — the plugin does not overwrite it. To pick up the new default, reset the key toBepInEx\plugins\CustomBoomboxMusicor delete the key and let it regenerate. - Drop-in
.lrcmatching andSharedLyricFolderare unaffected by this setting.
Developer API
Everything lives under the Lyriclib namespace (LyriclibApi for the entry points). The full reference — signatures, threading contract and examples — is shipped with the source repository as docs/API.md.
using Lyriclib;
if (LyriclibApi.IsReady) { /* library ready */ }
// Drive your own player: push the timeline every frame
// (1.5 s without a push is treated as "track ended")
LyriclibApi.PushPlayback(audioFilePath, timeSeconds, durationSeconds, "Display Name");
LyriclibApi.ClearPlayback();
// Queries are properties, not methods
bool hasLyrics = LyriclibApi.HasLyrics;
string line = LyriclibApi.CurrentLine;
LyriclibStatus s = LyriclibApi.GetStatus();
// Events
LyriclibApi.TrackChanged += info => { };
LyriclibApi.TrackStopped += () => { };
LyriclibApi.VisibilityChanged += visible => { };
// Control
LyriclibApi.ReloadLyrics(); // re-scan after editing .lrc files on disk
LyriclibApi.SetLyricsVisible(false);
// FLAC: decode off-thread, build the clip on the main thread
bool isFlac = LyriclibApi.IsFlac(bytes);
FlacAudio audio = LyriclibApi.Decode(bytes, out string error);
AudioClip clip = LyriclibApi.CreateClip(audio, "name");
Threading: pure computation such as
Decodemay run on a background thread.CreateClip,LoadTrackandPushPlaybackmust be called from the main thread.
Made with AI
The code, documentation and packaging of this mod were produced with the help of DeepSeek V4.1 flash. Requirement breakdown, refactoring, comments, documentation and release packaging involved human–AI collaboration; final implementation decisions and in-game testing were done by the maintainer. This disclosure is provided so users and downstream developers know how the project was built.
中文说明
Lyriclib 2.0.0
Lethal Company 通用歌词显示 + FLAC 播放支持。只要当前播放中的音频有对应歌词文件,就能在屏幕上看到歌词——不挑音源,不挑音乐模组。
1. 它能做什么
| 能力 | 说明 |
|---|---|
| 万能音源识别 | 自动识别正在播放的音频:CustomBoomboxMusic 等音乐模组曲库、其它模组主动推送、场景中任意 AudioSource |
| 同名歌词就近匹配 | 音频旁边放同名 .lrc 就能显示,不需要把歌加进任何配置目录 |
| TMP 原生字体显示 | 使用 TextMeshPro 渲染,中文字形由 TMP 动态图集生成 |
| 两种显示模式 | HudAboveHotbar:屏幕中下方、物品栏正上方;FloatingWindow:独立透明 UI 窗口 |
| 卡拉OK 渐变 | 已唱部分渐变到高亮色,未唱部分保持暗色,按字符宽度平滑推进 |
| 逐字时间轴 | 支持增强型 LRC 的 <mm:ss.xx> 逐字标签,有逐字标签时按字推进 |
| FLAC 播放 | 内置 FLAC 解码器,让 CustomBoomboxMusic 等模组直接播 .flac |
| 公共 API | 其它模组可以主动推送播放状态、查询歌词、开关显示 |
2. 安装
-
先装好 BepInEx 5.4.2305(Thunderstore Mod Manager / r2modman 会自动装这个依赖)。
-
把整个
BiliBiliMOXL-Lyriclib文件夹放进:...\LethalCompany\profiles\<你的配置名>\BepInEx\plugins\ -
启动一次游戏,会生成
BepInEx\config\Lyriclib.cfg和BepInEx\config\Lyriclib\lyrics\。 -
播放带同名
.lrc的音频即可看到歌词。
字体开箱可用:插件自带 fonts\LXGWWenKai-Regular.ttf,启动时以「进程私有」方式加载(Windows AddFontResourceEx + FR_PRIVATE),不安装到系统、不写注册表、退出游戏即失效,但 Unity / TMP 能在本次运行中使用它。万一该方式在你的机器上未生效,插件会按 霞鹜文楷 → 霞鹜文楷屏幕阅读版 → 微软雅黑 → Noto → 思源 → 黑体 的顺序回退,歌词不会消失;日志里会打印实际用到的字体族名。
3. 歌词文件怎么放
三种方式,任选其一:
| 方式 | 示例 | 说明 |
|---|---|---|
| 和音频同名同目录(最推荐) | CustomBoomboxMusic\歌曲名.mp3 + .lrc |
按文件名匹配,任意模组、任意目录都可用 |
| 放进共享歌词目录 | BepInEx\config\Lyriclib\lyrics\歌曲名.lrc |
不改动音频文件所在目录 |
放进 MusicRoots 里的音乐目录 |
见配置项说明 | 启动时与配置变更时建立索引 |
支持的歌词格式:普通 LRC、一行多时间戳、带元数据标签([ti:] [ar:] [offset:])、增强型逐字 LRC;异常行会被跳过而不是让整份歌词失效。
4. 配置项
[1. General](Lyriclib.cfg)
| 键 | 默认 | 说明 |
|---|---|---|
Enabled |
true | 歌词功能总开关 |
AutoDetectSources |
true | 自动探测游戏内 AudioSource(外部推送优先) |
MinTrackSeconds |
8 | 短于此长度的 clip 视为音效,不计入曲目 |
MusicRoots |
<plugins>\CustomBoomboxMusic |
建立索引的音乐目录,; 分隔,相对路径以 BepInEx 根目录为基准;默认只含 CustomBoomboxMusic 曲库,其它目录需自行在 cfg 中添加 |
SharedLyricFolder |
config\Lyriclib\lyrics |
共享歌词目录,按文件名匹配 |
[2. Display]
| 键 | 默认 | 说明 |
|---|---|---|
Mode |
HudAboveHotbar |
HudAboveHotbar(热键栏上方,无面板)/ FloatingWindow(浮动面板) |
FontSize |
30 | 主歌词字号 |
LineWidth |
1100 | 主歌词行宽 |
OffsetX / OffsetY |
0 / 0 | 屏幕像素偏移,正值右移 / 上移 |
WindowAnchorY |
0.28 | 浮动窗口垂直锚点(0 = 屏幕底部,1 = 顶部) |
BackgroundOpacity |
0 | 背景不透明度,0 = 全透明 |
ShowNextLine |
true | 是否显示下一句 |
ShowTrackTitle |
false | 是否显示歌名 |
SortingOrder |
30000 | 画布渲染层级,保证压在 HUD 之上 |
HideWhenNotInGame |
true | 不在飞船/设施内时隐藏 |
[3. Karaoke]
| 键 | 默认 | 说明 |
|---|---|---|
EnableSweep |
true | 卡拉 OK 扫词 |
PlayedColor |
#FFD24A |
已唱颜色 |
UnplayedColor |
#FFFFFF |
未唱颜色 |
SyncOffsetSeconds |
0 | 时间轴偏移,负值 = 歌词提前,正值 = 歌词延后 |
[4. Font]
| 键 | 默认 | 说明 |
|---|---|---|
FontFamily |
LXGW WenKai |
首选字体族(插件内置 ttf 会自动提供该族名) |
FontFallbacks |
LXGW WenKai Screen;Microsoft YaHei;Noto Sans CJK SC;SimHei |
兜底字体链,; 分隔 |
FontFile |
<plugin>\fonts\LXGWWenKai-Regular.ttf |
随插件附带的 TTF |
FontAssetName |
空 | 直接指定已加载的 TMP 字体资产名时优先使用 |
[Lyriclib.Flac.cfg] [General]
| 键 | 默认 | 说明 |
|---|---|---|
Enabled |
true | 让 CustomBoomboxMusic 等模组能播放 .flac |
5. 给其它模组用的 API
完整接口说明、线程约定与示例见源码仓库中的 docs/API.md。速览:
using Lyriclib; // 全部入口在 Lyriclib.LyriclibApi / Lyriclib.LyriclibLyrics
LyriclibApi.PushPlayback(audioFilePath, timeSeconds, durationSeconds, "显示名(可选)");
LyriclibApi.ClearPlayback();
bool hasLyrics = LyriclibApi.HasLyrics;
string line = LyriclibApi.CurrentLine;
LyriclibStatus s = LyriclibApi.GetStatus();
LyriclibApi.TrackChanged += info => { };
LyriclibApi.TrackStopped += () => { };
LyriclibApi.VisibilityChanged += visible => { };
LyriclibApi.ReloadLyrics();
LyriclibApi.SetLyricsVisible(false);
bool isFlac = LyriclibApi.IsFlac(bytes);
FlacAudio audio = LyriclibApi.Decode(bytes, out string error);
AudioClip clip = LyriclibApi.CreateClip(audio, "name");
线程约定:Decode 等纯计算可放后台线程;CreateClip / LoadTrack / PushPlayback 必须在主线程调用。
6. 排错
| 现象 | 原因 / 处理 |
|---|---|
| 完全看不到歌词 | 看 BepInEx\LogOutput.log 里是否有 [Lyriclib] 行;确认歌词是 .lrc 且与音频同名 |
| 歌词显示成方块 | 首帧中文字形生成失败 → 看日志 bundled font loaded privately 与最终字体族名;仍异常可手动安装 fonts\LXGWWenKai-Regular.ttf 后重启 |
| 歌词对不上拍 | 调 SyncOffsetSeconds(提前给负数、延后给正数),或检查 LRC 的 [offset:] |
| 长歌越唱越缺字 | 2.0 已开启动态多图集,若仍出现请反馈日志 |
.flac 不播放 |
确认 Lyriclib.Flac.cfg 中 Enabled = true,且音乐模组已加载该文件 |
7. 从 1.x 升级
1.x 的 Lyriclib.cfg 键名不同,直接启动会让新旧键混在一个文件里。建议把旧的 Lyriclib.cfg 删掉(已自动备份为 Lyriclib.cfg.v1.1.0.bak),让 2.0 生成干净配置。
8. MusicRoots 默认值变更
2.0.0 起,MusicRoots 的默认值只保留 BepInEx\plugins\CustomBoomboxMusic——代码里不再硬编码任何第三方模组的目录。
- 新装用户:首次生成的 cfg 里只有 CustomBoomboxMusic,需要其它目录时按
;分隔自行追加。 - 升级用户:如果
MusicRoots已被自定义过(含沿用旧的多目录值),插件会沿用你 cfg 里的现有值,不会覆盖;想让默认值生效,把该键改回BepInEx\plugins\CustomBoomboxMusic或删掉该键重新生成。 - 即使不配置
MusicRoots,同名.lrc就近匹配与SharedLyricFolder仍照常工作。
关于制作方式(AI 生成披露)
本模组的代码、文档与打包配置在开发过程中借助 DeepSeek V4.1 flash 辅助完成:需求拆解、代码重构、注释与文档撰写、发布包整理等环节均有人机协作参与,最终实现与测试由项目维护者负责。特此披露,供使用者与下游开发者参考。