const BENCHMARK_COPY = { text: { title: "Text Editing", description: "Localized substitution, insertion, deletion, and longer text edits in English and Mandarin.", }, emotion: { title: "Emotion Editing", description: "Phrase-level, multi-span, and whole-utterance emotion control.", }, prosody: { title: "Prosody Editing", description: "Pitch and speaking-rate control over one or more selected regions.", }, pause: { title: "Pause Editing", description: "Insertion and reduction of natural pauses at one or more boundaries.", }, multi: { title: "Compositional Editing", description: "Up to three text and acoustic operations in one instruction.", }, noise: { title: "Noise Preservation & Denoising", description: "Editing speech while preserving background sound, plus enhancement for denoising.", }, multi_speaker: { title: "Multi-speaker Preservation", description: "Editing a bilingual, two-speaker source without speaker labels in the instruction.", }, }; const escapeHtml = (value) => String(value) .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll('"', """); function audioCell(label, path, kind = "source") { const isOurs = kind === "ours"; return `
${escapeHtml(label)} ${isOurs ? 'Ours' : ""}
`; } function sampleRow(sample, index) { const players = [ audioCell("Source", sample.source_audio), ...sample.systems.map((system) => audioCell(system.label, system.audio, system.kind), ), ].join(""); const tags = sample.tags .map((tag) => `${escapeHtml(tag)}`) .join(""); return `
Example ${index + 1} ${escapeHtml(sample.focus)} ${tags}
Instruction
${sample.instruction_html}
${players}
`; } function renderSection(section) { const copy = BENCHMARK_COPY[section.benchmark] || { title: section.title, description: "", }; const pending = section.status === "pending_manual_samples"; const body = pending ? `
${escapeHtml(copy.description)}
` : `
${section.samples.map(sampleRow).join("")}
`; return `

${escapeHtml(copy.title)}

${escapeHtml(copy.description)}

${body}
`; } async function loadSamples() { const container = document.querySelector("#sample-sections"); try { const response = await fetch("data/samples.json", { cache: "no-store" }); if (!response.ok) throw new Error(`HTTP ${response.status}`); const data = await response.json(); container.innerHTML = data.sections.map(renderSection).join(""); } catch (error) { container.innerHTML = `
Could not load the audio examples: ${escapeHtml(error.message)}
`; } } loadSamples();