npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@applemusic-like-lyrics/lyric

v0.2.4

Published

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

Downloads

242

Readme

Lyric parser/writer for AMLL

警告:此为个人项目,且尚未完成开发,可能仍有大量问题,所以请勿直接用于生产环境!

AMLL-Lyric npm npm

一个 AMLL 的歌词解析/生成模块,使用 Rust 编写,并通过 wasm-pack 构建成 WASM 模块以提供给其他项目使用。

本模块由于只着重于歌词内容,所以会丢弃一切和歌词无关的信息,如需获取一个歌词文件中的详细信息(例如歌手)请考虑使用其他框架。

歌词格式支持表:

| 源格式\目标格式 | 解析自身格式 | LyRiC 格式 .lrc | ESLyric 逐词歌词格式 .lrc | 网易云音乐逐词歌词格式 .yrc | QQ 音乐逐词歌词格式 .qrc | Lyricify Syllable 逐词歌词格式 .lys | TTML 歌词格式 .ttml | ASS 字幕格式 .ass | | ------------------------------------- | ------------ | ----------------- | --------------------------- | ----------------------------- | -------------------------- | ------------------------------------- | --------------------- | ------------------- | | LyRiC 格式 .lrc | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ESLyric 逐词歌词格式 .lrc | ✅ | ✅ | / | ✅ | ✅ | ✅ | ✅ | ✅ | | 网易云音乐逐词歌词格式 .yrc | ✅ | ✅ [^1] | ✅ [^1] | / | ✅ | ✅ | ✅ | ✅ | | QQ 音乐逐词歌词格式 .qrc | ✅ | ✅ [^1] | ✅ [^1] | ✅ | / | ✅ | ✅ | ✅ | | Lyricify Syllable 逐词歌词格式 .lys | ✅ | ✅ [^1] | ✅ [^1] | ✅ [^2] | ✅ [^2] | / | ✅ | ✅ | | TTML 歌词格式 .ttml | ✅ | ✅ [^1] | ✅ [^1] | ✅ [^2] | ✅ [^2] | ✅ [^3] | / | ✅ | | ASS 字幕格式 .ass | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | / |

[^1]: 会丢失逐词时间数据、演唱属性(背景人声,对唱人声)和 AMLL 元数据 [^2]: 会丢失演唱属性(背景人声,对唱人声)和 AMLL 元数据 [^3]: 会丢失 AMLL 元数据

与 Core 歌词组件一起使用

在和二者合用的时候,需要注意两者的歌词行结构并不完全相同,需要进行诸如(以 LyRiC 举例)下面的方式进行转换方可被歌词组件正确解析:

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,
}));
// 此时就可以将 converted 传给 LyricPlayer 了

推荐使用 TypeScript,这样可以更方便地查错。

构建

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