jevstrudel.git / website / src / pages / jev-samples / lyrics.json.js

The words of the sample pack's sung and spoken clips, with where each syllable starts: samples/<sound>/<sound>.lyrics.json, one object per sound ({ text, seconds, syllables: [[syllable, startSeconds], …] }), gathered here as one map by sound. The page shows them as subtitles while a clip plays (src/jev/lyrics.mjs). Like the sample map beside it, the glob is live in the dev server.

7const files = import.meta.glob('../../../../samples/*/*.lyrics.json', { eager: true, import: 'default' });
9export function GET() {
10  const map = {};
11  for (const [path, lyric] of Object.entries(files)) map[path.split('/').at(-2)] = lyric;
12  return new Response(JSON.stringify(map), { headers: { 'Content-Type': 'application/json' } });
13}