// Makes a small mp3 for every in the lessons that does not have one yet. // Needs ELEVENLABS_API_KEY in the environment. Voice: Quentin (clear, neutral narrator), eleven_multilingual_v2. // Usage: ELEVENLABS_API_KEY=... node scripts/make-audio.mjs import fs from "fs"; import path from "path"; const VOICE = "Aa6nEBJJMKJwJkCx8VU2"; const OUT = "public/audio"; const key = process.env.ELEVENLABS_API_KEY; if (!key) throw new Error("Set ELEVENLABS_API_KEY"); // Same rule as src/lib/audio.ts const slug = (text) => text.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80).replace(/-+$/g, ""); const words = new Set(); (function walk(dir) { for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { const full = path.join(dir, entry.name); if (entry.isDirectory()) walk(full); else if (entry.name.endsWith(".mdx")) { for (const m of fs.readFileSync(full, "utf8").matchAll(/