Supertonic Language Codes: Complete List of 30 Supported Languages

Supertonic supports 30 languages via ISO-639-1 codes defined in the AVAILABLE_LANGS constant, with validation logic implemented in both the web and Node.js SDK helper modules.

The open-source Supertonic Text-to-Speech library by Supertone Inc. provides multilingual TTS capabilities through a standardized set of language codes. These codes are validated at runtime to ensure proper text processing and voice synthesis across supported locales.

Complete List of Supported Languages

Supertonic uses two-letter ISO-639-1 language codes to identify supported languages. The AVAILABLE_LANGS array in both the web and Node.js SDKs contains the following 30 language codes:

Code Language Code Language
en English lt Lithuanian
ko Korean lv Latvian
ja Japanese nl Dutch
ar Arabic pl Polish
bg Bulgarian pt Portuguese
cs Czech ro Romanian
da Danish ru Russian
de German sk Slovak
el Greek sl Slovenian
es Spanish sv Swedish
et Estonian tr Turkish
fi Finnish uk Ukrainian
fr French vi Vietnamese
hi Hindi
hr Croatian
hu Hungarian
id Indonesian
it Italian

These codes serve as the source of truth for the library's multilingual capabilities, enabling text wrapping in language-specific tags (e.g., <en>…</en>) and input validation.

How Language Validation Works

According to the Supertonic source code, language validation occurs in the helper modules before processing text. In web/helper.js and nodejs/helper.js, the library checks inputs against the AVAILABLE_LANGS array using isValidLang or AVAILABLE_LANGS.includes() checks.

When you call the TTS engine, the textToSpeech.call() method accepts the language code as the second parameter. If you provide a code not present in the supported list, the library throws an error rather than attempting synthesis.

Using Language Codes in Practice

Web Browser Implementation

In the browser SDK, import the helper functions from web/helper.js and pass your desired language code to the call method:

import { loadTextToSpeech, loadVoiceStyle } from './helper.js';

(async () => {
  const onnxDir = '/path/to/onnx/models';
  const { textToSpeech } = await loadTextToSpeech(onnxDir);
  const style = await loadVoiceStyle(['/path/to/style1.json']);

  // English TTS
  const resultEn = await textToSpeech.call(
    'Hello, world!',
    'en',
    style,
    30
  );
  console.log('English waveform length:', resultEn.wav.length);

  // Japanese TTS
  const resultJa = await textToSpeech.call(
    'こんにちは、世界!',
    'ja',
    style,
    30
  );
  console.log('Japanese waveform length:', resultJa.wav.length);
})();

Node.js Implementation

For server-side applications, the Node.js SDK in nodejs/helper.js mirrors the same API:

import { loadTextToSpeech, loadVoiceStyle } from './helper.js';

(async () => {
  const onnxDir = './onnx';
  const tts = await loadTextToSpeech(onnxDir);
  const style = loadVoiceStyle(['./styles/style1.json']);

  // Polish TTS
  const { wav } = await tts.call('Cześć, świecie!', 'pl', style, 30);
  // wav now contains the PCM audio data
})();

Both implementations validate the language code parameter before processing, ensuring only supported ISO-639-1 codes from AVAILABLE_LANGS are accepted.

Summary

  • 30 languages supported: Supertonic covers major global languages using ISO-639-1 codes including en, ko, ja, ar, and vi.
  • Centralized configuration: The AVAILABLE_LANGS constant in web/helper.js and nodejs/helper.js serves as the single source of truth.
  • Runtime validation: The isValidLang function and AVAILABLE_LANGS.includes() checks prevent unsupported language requests.
  • Consistent API: Both web and Node.js SDKs use identical language code parameters in the textToSpeech.call() method.

Frequently Asked Questions

What happens if I use an unsupported language code?

Supertonic validates all language inputs against the AVAILABLE_LANGS array before processing. If you pass a code not listed in the supported languages (such as zh for Chinese), the library throws an error indicating the invalid language parameter.

Are the supported languages identical between web and Node.js versions?

Yes, both the web SDK (web/helper.js) and Node.js SDK (nodejs/helper.js) maintain identical AVAILABLE_LANGS arrays and validation logic. This ensures consistent behavior whether you are running Supertonic in a browser environment or on a server.

How does Supertonic format text with language codes internally?

The library wraps input text in XML-style language tags using the provided code. For example, when you specify 'en' as the language parameter, the text processor formats the content as <en>…</en> before passing it to the inference engine, as implemented in the UnicodeProcessor class.

Which language code standard does Supertonic follow?

Supertonic uses ISO-639-1 two-letter codes exclusively. This standard provides the en, ko, ja designations found in the AVAILABLE_LANGS constant, ensuring compatibility with international localization practices.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →