{"_id":"@3sv1n/lrc","_rev":"3-adcedca2600d765b6661b8fc50c10733","name":"@3sv1n/lrc","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@3sv1n/lrc","version":"0.1.0","keywords":["lrc","lyrics","parser","audio"],"author":{"name":"3sv1n"},"license":"MIT","_id":"@3sv1n/lrc@0.1.0","maintainers":[{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"}],"homepage":"https://github.com/esvinjoshua/stem-packages/tree/main/packages/lrc#readme","bugs":{"url":"https://github.com/esvinjoshua/stem-packages/issues"},"dist":{"shasum":"392d85f1c0faeff99c29b6f5d433138ac7e82733","tarball":"https://registry.npmjs.org/@3sv1n/lrc/-/lrc-0.1.0.tgz","fileCount":8,"integrity":"sha512-ol+k4EHdErYpEmd5LBpUgUViqx1++dFgt3XveuPzpXjIw2ay8irhNF/S7TxMafduPwmuHE2p8/mYuAtAHMnBTg==","signatures":[{"sig":"MEYCIQCAzjmUFfuvDZ3gbcDhBQIgtre806n/09iPEZ24DkyPzAIhAJWRb/mcZEFqq/e/jlBJeTKvkBbzzD5t0qFEaNe01STg","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25435},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"379be8a373efec3ee77f8e9088f4faa0682c4fe7","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup"},"_npmUser":{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"},"repository":{"url":"git+https://github.com/esvinjoshua/stem-packages.git","type":"git","directory":"packages/lrc"},"_npmVersion":"11.8.0","description":"Framework-agnostic parser and utilities for LRC lyric files","directories":{},"_nodeVersion":"25.5.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","vitest":"^1.5.0","typescript":"^5.4.5"},"_npmOperationalInternal":{"tmp":"tmp/lrc_0.1.0_1780649062267_0.3315206622098641","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@3sv1n/lrc","version":"0.1.1","keywords":["lrc","lyrics","parser","audio"],"author":{"name":"3sv1n"},"license":"MIT","_id":"@3sv1n/lrc@0.1.1","maintainers":[{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"}],"homepage":"https://github.com/esvinjoshua/stem-packages/tree/main/packages/lrc#readme","bugs":{"url":"https://github.com/esvinjoshua/stem-packages/issues"},"dist":{"shasum":"f176f52cf4fc0c81679851f8ee7f1a54a4d80e3b","tarball":"https://registry.npmjs.org/@3sv1n/lrc/-/lrc-0.1.1.tgz","fileCount":8,"integrity":"sha512-xNK/gARfIHhWPcrhA3mCu0c1KUafClo/dFTZvzwwWbsP81gj9PEXHAnu5Et3X5J0BRq4MZnDOlpJ5nDKw3nYoA==","signatures":[{"sig":"MEUCIQDih1Yl6lJP5RHj9WmA+zZ2D1EjnzgsHhnnAJK3LgiEcgIgdAZBLF54/2txjRRvEqzCe+Z2aTA1ISztoZG5N4C11ck=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25435},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"379be8a373efec3ee77f8e9088f4faa0682c4fe7","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup"},"_npmUser":{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"},"repository":{"url":"git+https://github.com/esvinjoshua/stem-packages.git","type":"git","directory":"packages/lrc"},"_npmVersion":"11.8.0","description":"Framework-agnostic parser and utilities for LRC lyric files","directories":{},"_nodeVersion":"25.5.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","vitest":"^1.5.0","typescript":"^5.4.5"},"_npmOperationalInternal":{"tmp":"tmp/lrc_0.1.1_1780649696900_0.5064711705201281","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@3sv1n/lrc","version":"0.1.2","description":"Framework-agnostic parser and utilities for LRC lyric files","author":{"name":"3sv1n"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/3sv1n/stem-packages.git","directory":"packages/lrc"},"homepage":"https://github.com/3sv1n/stem-packages/tree/main/packages/lrc#readme","keywords":["lrc","lyrics","parser","audio"],"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run"},"devDependencies":{"tsup":"^8.0.2","typescript":"^5.4.5","vitest":"^1.5.0"},"gitHead":"379be8a373efec3ee77f8e9088f4faa0682c4fe7","_id":"@3sv1n/lrc@0.1.2","bugs":{"url":"https://github.com/3sv1n/stem-packages/issues"},"_nodeVersion":"25.5.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-tuUKj2uZpcqDeq3DWwsMD/fr2z6tLu/BzX2oovDqnYd5eLDt9XVtsO3ZFpBfvwpro2SChC/To2HE8rMu5GmHEA==","shasum":"38e64497d67a12e86825540436db97ca1815827f","tarball":"https://registry.npmjs.org/@3sv1n/lrc/-/lrc-0.1.2.tgz","fileCount":8,"unpackedSize":25423,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDJzGioBEVgDZvIDGKG2cCY4VHMPHJjBs1KyOPB3Asb2wIhAINklbNKEiuK7UTnDOR7L1RGnPesCBq7cKuMXJ80NlPF"}]},"_npmUser":{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"},"directories":{},"maintainers":[{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lrc_0.1.2_1780650077455_0.6343259468157769"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-05T08:44:22.142Z","modified":"2026-06-05T09:01:17.763Z","0.1.0":"2026-06-05T08:44:22.440Z","0.1.1":"2026-06-05T08:54:57.114Z","0.1.2":"2026-06-05T09:01:17.605Z"},"bugs":{"url":"https://github.com/3sv1n/stem-packages/issues"},"author":{"name":"3sv1n"},"license":"MIT","homepage":"https://github.com/3sv1n/stem-packages/tree/main/packages/lrc#readme","keywords":["lrc","lyrics","parser","audio"],"repository":{"type":"git","url":"git+https://github.com/3sv1n/stem-packages.git","directory":"packages/lrc"},"description":"Framework-agnostic parser and utilities for LRC lyric files","maintainers":[{"name":"esvinjoshuab","email":"joshua.esvin312@gmail.com"}],"readme":"# @3sv1n/lrc\n\nA pure, framework-agnostic parser and serializer for LRC lyric files.\n\n## Features\n- **Zero dependencies:** Works in browser and Node.js.\n- **Robust parsing:** Handles standard `[mm:ss.xx]` and `[mm:ss.xxx]` timestamp formats.\n- **Utility functions:** Built-in tools for offsetting, shifting, and finding the active lyric line for a given time.\n\n## Installation\n\n```bash\nnpm install @3sv1n/lrc\n# or\nyarn add @3sv1n/lrc\n# or\npnpm add @3sv1n/lrc\n```\n\n## Basic Usage\n\n### Parsing LRC\n\n```typescript\nimport { parseLrc } from '@3sv1n/lrc';\n\nconst rawLrc = `\n[00:12.00]Line 1 lyrics\n[00:15.30]Line 2 lyrics\n`;\n\nconst lines = parseLrc(rawLrc);\n/*\n[\n  { time: 12.00, text: \"Line 1 lyrics\" },\n  { time: 15.30, text: \"Line 2 lyrics\" }\n]\n*/\n```\n\n### Finding the Active Line\n\nGiven an array of parsed `LyricLine`s and a current playback time in seconds, you can quickly find which line is currently active.\n\n```typescript\nimport { getActiveLineIndex } from '@3sv1n/lrc';\n\nconst activeIndex = getActiveLineIndex(lines, 13.5); \n// Returns 0 (Line 1 lyrics)\n```\n\n## API Reference\n\n### Types\n\n```typescript\ninterface LyricLine {\n  time: number; // Time in seconds\n  text: string;\n}\n\ninterface ParseOptions {\n  /** Whether to trim whitespace from the beginning and end of lyric text. Default is true. */\n  trimWhitespace?: boolean;\n}\n```\n\n### `parseLrc(lrcString: string, options?: ParseOptions): LyricLine[]`\nParses an LRC format string into an array of chronologically sorted `LyricLine` objects.\n\n### `serializeLrc(lines: LyricLine[]): string`\nSerializes an array of `LyricLine` objects back into an LRC format string. It automatically sorts the lines chronologically before outputting.\n\n### `getActiveLineIndex(lines: LyricLine[], timeInSeconds: number): number`\nReturns the index of the active lyric line for a given time. Returns `-1` if the time is before the first line.\n\n### `offsetLyrics(lines: LyricLine[], offsetSeconds: number): LyricLine[]`\nReturns a new array of lines with the offset added to the time of each line. Useful when audio and lyrics are slightly out of sync.\n\n### `shiftLyrics(lines: LyricLine[], scaleFactor: number): LyricLine[]`\nReturns a new array of lines with their times multiplied by `scaleFactor`.\n\n### `sortLyrics(lines: LyricLine[]): LyricLine[]`\nReturns a chronologically sorted copy of the lyric lines.\n\n### `validateLyrics(lines: LyricLine[]): boolean`\nReturns `true` if the lines array is chronologically sorted and times are non-negative.\n","readmeFilename":"README.md"}