Projects

TTS Front

A TTS-agnostic C++17 library for text normalization, pronunciation, and word stress preparation before speech synthesis.

  • cpp
  • ai
  • tts
  • text-processing
Source code

What it does

TTS Front prepares text before it reaches a speech synthesizer. The library normalizes numbers, abbreviations, dates, and technical expressions, applies pronunciation dictionaries, and represents word stress independently of any particular TTS model. This allows applications to share a text preparation layer across different speech synthesis engines.

The library is written in C++17 and requires neither Python, PyTorch, nor a specific TTS engine. The ONNX Runtime-based Silero Stress backend is optional.

Features

  • Russian and English text normalization: numbers, dates, monetary amounts, and units.
  • Abbreviations and technical expressions.
  • Custom pronunciation dictionaries and explicit stress marks.
  • Full and selective automatic word stress through the optional Silero/ONNX backend.
  • Mixed Russian and English text.
  • Diagnostics for ambiguous and unsupported constructs.

What's new in v0.2.7

The stable release of December 4, 2026 adds AutomaticHomographsOnly for selective automatic stress. DictionaryOnly remains the default, and Automatic retains its existing behavior. No model is bundled or downloaded automatically.

The release refines dictionary replacements and combining Unicode marks, mixed text, and email address boundaries. Explicit stress and dictionary precedence are preserved; full Unicode NFC normalization is not claimed.

Text transformation examples

The first three Russian examples show number agreement within the supported noun catalogue. The last two show selective stress in isolated phrases verified with Silero: a door lock (замо́к) and an old castle (за́мок).

2 задачи → две задачи
1 окно → одно окно
21 сообщение → двадцать одно сообщение
дверной замок → дверной замо́к
старый замок → старый за́мок

Test corpus

The fixed tts-front-cpp v0.2.7 corpus contains 776 examples. These results describe that corpus and do not guarantee correctness for arbitrary input.

  • 672 correct transformations.
  • 104 justified preservations of the input.
  • 0 unnecessary refusals.
  • 0 incorrect or partial results.

Integration

After installation, set CMAKE_PREFIX_PATH and use find_package(TtsFront 0.2.7 CONFIG REQUIRED), then target_link_libraries(app PRIVATE TtsFront::tts_front). The public header is <tts_front.hpp>, and C++17 is required.

#include <tts_front.hpp>

tts_front::TextFrontend frontend;
tts_front::TextFrontendOptions options;
options.language = tts_front::Language::Russian;
const auto result = frontend.process("В 2026 г. API готов.", options);

Limitations

Russian number agreement is limited to a catalogue of 14 nouns and assumes an already correct input word form. General Russian morphology and arbitrary agreement repair are not supported.

Selective processing does not eliminate Silero contextual prediction errors: in a longer test phrase the model selected the same stress for both occurrences of «замок». A dictionary can specify pronunciation explicitly. The new mode was verified on prepared text, without generating or evaluating audio.

Recommended version

Use the published v0.2.7 release for Russian and English text normalization.

Git
git clone --branch 'v0.2.7' --single-branch https://github.com/LimiNode/tts-front-cpp.git

Documentation for this revision

Collaboration

Get in touch to discuss using or extending this project, or working on related research.

Discuss a project