Task: Develop a custom Vietnamese text-to-speech pipeline and audio dictionary

Develop a custom Vietnamese text-to-speech pipeline and audio dictionary

19.09.2026vietnamguru.ru

Eliminate the dependency on browser speechSynthesis for Vietnamese and implement managed generation, verification, and storage of audio using OpenRouter + Google Gemini.

Context

Initial research showed that relying on the browser's speechSynthesis for the Vietnamese language is not feasible.

Why browser speechSynthesis is unsuitable

  • The voice for Vietnamese cannot be reliably set in the browser.
  • The available installation path via Reading Mode is inconvenient for a regular user: open reading mode → settings → languages → add Vietnamese → wait for voices to download.
  • In practice, after enabling Vietnamese, a Downloading voices ... message appears, after which the download may hang indefinitely.
  • Official documentation does not provide a transparent guarantee of support for a specific Vietnamese voice.
  • In Chromium sources, the language may be declared, but Chromium itself does not contain the final voice dictionaries: voice availability and quality depend on the specific browser/service provider, in our case Google.
  • Even if the voice is available to the developer, users cannot be required to install additional system or browser dictionaries just to use the course.

Second issue: Quality

The developer is not a native Vietnamese speaker and cannot independently guarantee phonetic correctness, tone naturalness, and synthesis quality. Therefore, a controlled generation pipeline followed by verification by a native speaker is needed.

Solution

Implement a custom text-to-speech pipeline via OpenRouter + Google Gemini.

Do not generate audio on every user request. Instead, create a persistent audio dictionary.

Base Model

  1. An entity/dictionary of units for audio appears in the system: letter, syllable, word, phrase, or other learning element.
  2. For missing audio, generation is triggered via OpenRouter + Google Gemini.
  3. The resulting audio file is saved to file storage.
  4. Metadata and the connection to the learning unit are saved in the database.
  5. Subsequent requests use the already saved file.
  6. There must be a way to re-generate specific audio without changing the learning unit itself.
  7. A native speaker later checks the quality and marks suitable/unsuitable options.

Things to Consider

  • structure of the audio entity in the database;
  • types of voiced objects: letter, sound, syllable, word, phrase;
  • storage of source text and generation parameters;
  • provider/model and model version;
  • format and storage location of audio files;
  • caching and reuse;
  • statuses: generated / needs review / confirmed by native speaker / rejected;
  • re-generation and versioning;
  • differences between Northern and Southern pronunciation, if multiple voice options are needed;
  • bulk generation for the primer and dictionary;
  • ability to manually upload a native speaker's reference recording;
  • quality review interface.

First Practical Stage

First, provide high-quality audio for the primer:

  • basic vowels;
  • consonants and combinations;
  • six tones on the same/comparable syllable;
  • main diphthongs and triphthongs;
  • word examples.

After quality confirmation, expand the same mechanism to the entire course dictionary.

Result Criterion

The user receives audio without installing any system voices or dictionaries. The same learning element is played from pre-generated and saved audio, and the quality can be independently checked and confirmed by a native speaker.

Ворклоги

Issue with single-letter text-to-speech via OpenRouter

The basic TTS mechanism via OpenRouter is generally implemented and works for regular text units. However, a technical issue has been discovered with minimal inputs: if only a single letter is sent for synthesis, OpenRouter returns an HTTP 400.

For vietnamguru.ru, this is critical because the alphabet primer requires separate pronunciation of letters, sounds, and other very short phonetic units.

Current Solution

Do not block the entire TTS pipeline due to this limitation, but instead separately investigate local generation using a custom local server and a local TTS model. The goal is to obtain a mechanism that reliably accepts single letters/syllables and saves the result into the already established audio dictionary.

Related Task

A subtask has been created: "Investigate and implement local TTS generation via a local server", taskId cmu90kv7v0wm0qw0qnov80p68.

It requires selecting and testing a local model for Vietnamese, evaluating tone quality and short units, checking local server API, hardware requirements, and integration with the existing audio storage.

Full Interim Summary on TTS and Local Vietnamese Voiceover

This work relates to the task «Develop a custom Vietnamese voiceover pipeline and audio dictionary».

Initial Problem

Initially, browser speechSynthesis was considered, followed by generation via OpenRouter + Google Gemini.

Browser speechSynthesis for Vietnamese proved unsuitable as a basic mechanism for the course: voice installation is opaque, depends on the specific browser/provider, can freeze on Downloading voices ..., and requiring users to manually install language voices is not acceptable.

Next, a TTS pipeline was implemented via OpenRouter. Overall, it works for regular text, but a critical limitation was discovered with minimal inputs: when trying to voice a single separate letter, OpenRouter/Gemini returns HTTP 400 or fails to produce a usable result. For regular TTS this might be acceptable, but for a primer, it is a blocking problem because we need individual letters, graphemes, short syllables, and minimal phonetic units.

Because of this, a separate technical branch was created: «Research and implement local TTS voiceover via a local server».


Transition to Local Generation

The VieNeu-TTS project has been set up locally in Docker.

Version 2 is currently being used, which was the subject of previous experiments; a newer version 3 also exists.

Key practical result: VieNeu-TTS is able to stably and clearly voice individual Vietnamese letters/graphemes. This fundamentally distinguishes it from the current Gemini pipeline.

Why This Matters Specifically for a Primer

For Vietnamese, we need not just a universal "text reader", but a generator of minimal educational units:

  • individual vowels;
  • individual graphemes with tones;
  • short syllables;
  • diphthongs/triphthongs;
  • minimal contrasts;
  • individual words;
  • followed by short phrases.

In other words, the TTS must support targeted requests like "voice this specific grapheme/syllable," rather than requiring sentence context.

VieNeu-TTS already demonstrates a significant advantage on this criterion.

The theoretical basis regarding which specific units need to be voiced is documented in the concepts:

Example: The 18 Forms of Group A

For the basic Latin form a in Vietnamese, there are three different vowels:

  • a;
  • ă;
  • â.

Each of them can carry one of six tones, yielding 18 written forms:

  • a á à ả ã ạ;
  • ă ắ ằ ẳ ẵ ặ;
  • â ấ ầ ẩ ẫ ậ.

VieNeu-TTS is capable of separately voicing such minimal units.

For the course, this means a natural structure:

grapheme → saved audio recording.

After generation, each variant can be saved to file storage and reused without querying the TTS on every playback.

Acoustic Value of the Synthetic Set

The spectrogram of the generated set shows that individual utterances are well-separated and possess a distinguishable internal structure.

For further analysis, it is useful to view the 18 variants not as 18 completely independent classes, but as a combination of two factors:

  1. vowel quality: a / ă / â;
  2. tone: ngang / sắc / huyền / hỏi / ngã / nặng.

Theoretically, this allows analyzing the features separately:

  • F1/F2 and duration → which vowel;
  • F0 contour, duration, energy, voicing, and phonation features → which tone;
  • then combining the result into a specific grapheme.

This can be useful not only for generation, but also as a basis for a synthetic ground truth for future experiments on "sound → phonetic features/grapheme."

Why VieNeu-TTS Looks Promising

The project is specialized specifically for the Vietnamese language, developed in Vietnam, and trained on a large volume of Vietnamese speech. According to available information, version 2 used over 10,000 hours of Vietnamese recordings.

This does not replace validation, but it makes the model much more relevant to our task than a universal multilingual TTS.

Quality Validation

The final quality of individual sounds and tones will be checked with native speakers.

The primary things to check are:

  • tone distinguishability;
  • correctness of hỏi/ngã;
  • brevity of ă/â;
  • naturalness of individual letters/syllables out of context;
  • regional accent;
  • absence of artifacts on very short inputs.

Thus, the trust architecture is currently envisioned as follows:

VieNeu-TTS = main local candidate generator

native speakers = quality validators

our database = stores confirmed/accepted audio recordings

The requirements for this part of the system are also gathered in the concept «Voiceover and audio layer of the Vietnamese language course».

Storage Architecture

Voiceover does not need to be generated every time.

For each educational unit, the following must be stored:

  • text/grapheme/syllable;
  • unit type;
  • audio file;
  • engine and model version;
  • generation parameters;
  • pronunciation variant/dialect if necessary;
  • verification status;
  • capability for re-generation;
  • capability to replace a synthetic recording with a live native speaker recording.

It makes sense to keep statuses along the lines of:

  • generated;
  • needs_review;
  • approved;
  • rejected.

Current Practical Conclusion

For Vietnamguru, local VieNeu-TTS currently looks like a much more suitable base mechanism for the primer than Google Gemini via OpenRouter, because it works stably on minimal inputs and can voice individual letters/graphemes.

Even if another engine turns out to be of higher quality for long speech later on, the ability to reliably synthesize minimal units is a separate critical criterion for our project.

The entire methodological framework of the project is gathered in the concept «Vietnamese language: system and learning methodology», and practical course development is carried out in the task «Develop a Vietnamese language learning system for an adult audience».