@applemusic-like-lyrics/lyric

中文文档
1.1.0发布于 2026/09/20AGPL-3.0-onlyTypeScriptESM + CJS构建来源已验证近 30 天下载 4389

一个歌词解析/生成模块,着重于歌词内容解析,支持多种格式

原始使用文档
文档目录5 节
  1. Parse and generation support
  2. Format capability support
  3. Conversion and degradation rules
  4. Using with Core Lyric Component
  5. Building

Lyric parser/writer for AMLL

English / 简体中文

This is a refactored version of the original lyrics pack. Docs not finished yet.

Below is the original docs. See also: AMLL Docs.


Warning: This is a personal project and is still under development. There may still be many issues, so please do not use it directly in production environments!

AMLL-Lyric npm npm

A lyric parsing/generation module for AMLL, written entirely in TypeScript.

Since this module focuses only on lyric content, it discards all information unrelated to lyrics. If you need to get detailed information from a lyric file (such as artist), please consider using other frameworks.

Parse and generation support

FormatCommon extensionParseGenerate
LyRiC.lrc✅✅
LRC A2 (enhanced LRC).lrc✅✅
ESLyric word-by-word lyrics.lrc✅✅
Salt Player Lyrics (SPL).spl✅✅
NetEase word-by-word lyrics.yrc✅✅
QQ Music word-by-word lyrics.qrc✅✅
Lyricify Syllable.lys✅✅
Lyricify Lines.lyl✅✅
Lyricify Quick Export.lqe✅✅
TTML.ttml✅✅
ASS.ass❌✅

Format capability support

Each format has different syntax rules, so the lyric capabilities it supports, such as word-level timing, translations, and vocal-part information, also differ:

FormatTiming granularityTranslation / transliterationDuetBackground vocalsMetadata
LyRiC (.lrc)Line-level⚠️ Written as additional lyric lines❌⚠️ Text wrapped in ()❌
LRC A2 (.lrc)Word-level⚠️ Written as additional lyric lines❌⚠️ Text wrapped in ()❌
ESLyric (.lrc)Word-level⚠️ Written as additional lyric lines❌⚠️ Text wrapped in ()❌
SPL (.spl)Word-level⚠️ Written as additional lyric lines❌⚠️ Text wrapped in ()✅
NetEase (.yrc)Character-level❌❌⚠️ Text wrapped in ()❌
QQ Music (.qrc)Character-level❌❌⚠️ Text wrapped in ()❌
Lyricify Syllable (.lys)Word-level❌✅✅❌
Lyricify Lines (.lyl)Line-level❌❌⚠️ Text wrapped in ()❌
Lyricify Quick Export (.lqe)Word-level✅✅✅❌
TTML (.ttml)Word-level✅✅✅✅
ASS (.ass)Word-level❌❌⚠️ Text wrapped in ()❌

Conversion and degradation rules

When converting between formats through AMLL's internal structure, the following degradation rules apply when the target format lacks a capability provided by the source format:

  1. Word-level timing degradation: When the target format only supports line-level lyrics, such as LyRiC .lrc and Lyricify Lines .lyl, word-level timestamps are stripped and all words on a line are merged into a single line.
  2. Translation and transliteration degradation:
    • When exporting to an LRC-family format (LyRiC, LRC A2, ESLyric, or SPL), translations and transliterations are inserted as additional lyric lines with the main line's timestamp.
    • When exporting to word-level formats other than TTML (YRC, QRC, LYS, or LYL), translations and transliterations are discarded.
  3. Background vocals: When the target format has no native background-vocal marker, background vocals are written with parentheses around the lyric text: (...).
  4. Duet attributes: Only LYS, LQE, and TTML preserve duet information. It is lost when exporting to other formats.
  5. Metadata: To preserve metadata when exporting to SPL, pass the complete parse result containing metadata to stringifySPL. Metadata is written as [key:value] tag lines, and keys are converted to lowercase when parsed again. Formats other than TTML and SPL do not support metadata.
  6. Timestamp precision loss: ASS karaoke effects use centiseconds (1 cs), so exporting from a millisecond-based format to ASS rounds timestamps and may lose up to 10 milliseconds of precision.

Using with Core Lyric Component

When using them together, note that the lyric line structures of the two are not exactly the same. You need to convert them in a way like the following example (using LyRiC as an example) for the lyric component to parse correctly:

import { parseLrc } from "@applemusic-like-lyrics/lyric";
const lines = parseLrc("[00:00.00]test");
const converted = lines.map((line, i, lines) => ({
    words: [
        {
            word: line.words[0]?.word ?? "",
            startTime: line.words[0]?.startTime ?? 0,
            endTime: lines[i + 1]?.words?.[0]?.startTime ?? Infinity,
        },
    ],
    startTime: line.words[0]?.startTime ?? 0,
    endTime: lines[i + 1]?.words?.[0]?.startTime ?? Infinity,
    translatedLyric: "",
    romanLyric: "",
    isBG: false,
    isDuet: false,
}));
// Now you can pass converted to LyricPlayer

Using TypeScript is recommended as it makes it easier to detect errors.

Building

wasm-pack build --target bundler --release --scope applemusic-like-lyrics

版本与发布记录

@applemusic-like-lyrics/lyric 共发布 18 个版本,首次发布于 2023/07/27;过去 12 个月发布了 7 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.1.0latest2026/09/201 个月前
1.0.22026/07/103 个月前
1.0.12026/05/185 个月前
1.0.02026/04/236 个月前
1.0.0-alpha.02026/04/156 个月前
0.4.12026/04/037 个月前

关于 @applemusic-like-lyrics/lyric 的常见问题

@applemusic-like-lyrics/lyric 是什么?

一个歌词解析/生成模块,着重于歌词内容解析,支持多种格式

如何安装 @applemusic-like-lyrics/lyric?

在项目目录运行 npm install @applemusic-like-lyrics/lyric,或使用 pnpm add / yarn add / bun add。

@applemusic-like-lyrics/lyric 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@applemusic-like-lyrics/lyric 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@applemusic-like-lyrics/lyric 可以商用吗?

@applemusic-like-lyrics/lyric 使用 AGPL-3.0-only 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@applemusic-like-lyrics/lyric 的下载量有多少?

根据 npm 官方下载统计,@applemusic-like-lyrics/lyric 在 2026/10/07 – 2026/11/05 这 30 天内被下载 4,389 次,日均约 146 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@applemusic-like-lyrics/lyric 还在维护吗?

最新版本 1.1.0 发布于 2026/09/20(1 个月前);至今共发布 18 个版本,其中过去 12 个月发布了 7 个;首次发布于 2023/07/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。