Setting the file. One moment.
Subchapter 18.95
audio/scripts/lib/voice-credit.mjs
JavaScript17 lines686 B
// voice-credit.mjs — the credits line for a run's voices, naming where each voice really came from.
const VENDORS = {
heygen: "HeyGen",
elevenlabs: "ElevenLabs",
gemini: "Google Gemini",
kokoro: "Kokoro (open-source, run locally)",
};
/** "Voice: ..." for the voices an audio run made or took in, or null when it has none. */
export function voiceCredit(voices, ttsProvider) {
const sources = new Set(voices.map((v) => v.source ?? ttsProvider).filter(Boolean));
if (sources.size === 0) return null;
const parts = [...sources].map((s) =>
s === "recording" ? "your own recording" : `AI-generated by ${VENDORS[s] ?? s}`,
);
return `Voice: ${parts.join("; ")}`;
}