Text-to-speech · Synthesize multilingual speech with Supertonic3 / 4
  1. 01
  2. 02
  3. 04

Synthesize multilingual speech with Supertonic

Example on GitHub(packages/sdk/examples/tts/supertonic-multilingual.ts)

Now that we can synthesize English with Supertonic, we're going to add languages. Supertonic 3 covers 31 languages from a single multilingual GGUF.

The load is the same as the English Supertonic lesson. The only field that changes is language.

Loading the multilingual model is the same as the English lesson:

const modelId = await loadModel({
  modelSrc: TTS_MULTILINGUAL_SUPERTONIC3_Q8_0,
  modelConfig: {
    ttsEngine: "supertonic",
    language: "es",
    voice: "F1",
    ttsSpeed: 1.05,
    ttsNumInferenceSteps: 5,
  },
});

The voices are language-agnostic. F1 is a female voice, F2 a second female voice, M1 and M2 male voices. The same voice ID reads out the text in whatever language modelConfig.language selects. Switching from "es" to "fr" gives you the same voice reading French.

Same synth-call shape, with language: "es" carried into the options. Consider the following synth call:

const result = textToSpeech({
  modelId,
  text: "Hola mundo. Esta es una demostración de síntesis de voz con Supertonic en español.",
  inputType: "text",
  stream: false,
});
const audioBuffer = await result.buffer;
console.log(`▸ TTS complete. Total samples: ${audioBuffer.length}`);

Note: language codes that aren't in the Supertonic model's vocabulary fall back to English. If you need a specific dialect or regional accent, check the upstream Supertonic docs for the supported language list.

Put it to the test

  1. Call loadModel with modelConfig.ttsEngine: "supertonic", a non-English language, and a voice.
  2. Call textToSpeech({ modelId, text, inputType: "text", stream: false }) and await result.buffer.
  3. Log the sample count.
index.ts

$ Run your code to see results

$