Lyric toolkit for parsing, generating and processing
Warning
This project is currently under development, and some interfaces are not yet stable.
- Format inference — Auto-detect lyric format from input content
- Plugin system — Built-in plugins, load on demand
- Pipeline API — Fluent chainable API for full control over processing order
npm install music-lyric-kitThe pipeline provides a fluent, chainable interface that gives you full control over the processing order.
import { createParserPipeline } from 'music-lyric-kit'
const input = {
content: '[00:01.114]Hello world',
}
const { format, result } = createParserPipeline(input)
.infer()
.parse()
.backgroundExtract()
.agentExtract()
.pureExtract()
.pureClean()
.backgroundClean()
.interludeInsert()
.spaceInsert()
.stressMark()
.final()
console.log(format, result)Each transform method accepts an optional options parameter to customize behavior. If omitted, plugin defaults are used.
const { result } = createParserPipeline(input)
.infer()
.parse()
.interludeInsert({ checkTime: { first: 3000, normal: 8000 } })
.spaceInsert({ original: true, extended: false })
.final()For more granular control, you can use the Parser class with plugins directly.
import { Parser, Plugins } from 'music-lyric-kit'
const parser = new Parser()
// Format plugins
parser.plugin.add(new Plugins.Formats.Lrc.Parser())
parser.plugin.add(new Plugins.Formats.Ttml.AmllParser())
// Transform plugins
parser.plugin.add(new Plugins.Transforms.Space.InsertPlugin())
parser.plugin.add(new Plugins.Transforms.Stress.MarkPlugin())
const input = {
original: '[00:01.114]Hello world',
}
// Infer format
const format = parser.infer({ content: input })
if (format) {
const result = parser.parse(format, { content: input })
console.log(result)
}import { Generator, Plugins } from 'music-lyric-kit'
const generator = new Generator()
generator.plugin.add(new Plugins.Formats.Lrc.Generator())
const output = generator.generate('lrc', { content: result })
console.log(output)| Package | Description |
|---|---|
| music-lyric-kit | Main entry |
| @music-lyric-kit/core | Plugin system |
| @music-lyric-kit/lyric | Data structures |
| @music-lyric-kit/utils | Utilities |
| Plugin | Description |
|---|---|
| @music-lyric-kit/plugin-format-lrc | LRC |
| @music-lyric-kit/plugin-format-ttml | TTML |
| Plugin | Description |
|---|---|
| @music-lyric-kit/plugin-transform-space | Space normalization |
| @music-lyric-kit/plugin-transform-pure | Pure lyric detection |
| @music-lyric-kit/plugin-transform-interlude | Interlude handling |
| @music-lyric-kit/plugin-transform-background | Background vocals |
| @music-lyric-kit/plugin-transform-agent | Multi-voice support |
| @music-lyric-kit/plugin-transform-stress | Stress marks |
Copyright (c) 2026 - now, Folltoshe