You are viewing a potentially older version of this package. View all versions.
BROHEIM_CYBRP-BroheimSileroTTS-1.0.0 icon

BroheimSileroTTS

Self-contained in-game TTS for Valheim - speaks chat, runes, raven/intro, center-screen messages, dreams and NPC dialogue. Bundled pure-C# Silero neural voices (RU/EN/DE) via TorchSharp. No Python, no extra downloads, no Piper.

Date uploaded 2 weeks ago
Version 1.0.0
Download link BROHEIM_CYBRP-BroheimSileroTTS-1.0.0.zip
Downloads 6
Dependency string BROHEIM_CYBRP-BroheimSileroTTS-1.0.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

Broheim Silero TTS

Self-contained in-game text-to-speech for Valheim. The mod speaks aloud the text you normally only read: chat messages, rune/raven and intro text, center-screen messages, dreams and NPC dialogue — powered entirely by bundled Silero neural voices running in pure C# through TorchSharp (libtorch).

No Python, no extra client-side install, no runtime downloads. Voices work out of the box on the first launch.

Inspired by Azumatt's TextToSpeech

This mod was inspired by Azumatt's TextToSpeech — the idea of speaking Valheim's chat, runes, raven and NPC text aloud. All code in this package is written from scratch; a big thank-you to Azumatt for the original concept and for his work in the Valheim modding community.

Language Model Speakers Notes
🇷🇺 Russian v4_ru 5 Automatic stress marking + ё, digits → words, Latin → Cyrillic transliteration.
🇬🇧 English v3_en 119 (12 curated) 12 hand-picked male/female voices grouped by pitch.
🇩🇪 German v3_de 5 Umlaut handling (ß/ä/ö/ü).

This is a client-side mod — it does not need to be installed on, and is not synced to, the dedicated server.


Requirements

  • BepInExPack Valheim — Thunderstore package denikson-BepInExPack_Valheim (declared as a dependency).
  • Windows x64 client. The bundled libtorch native runtime (torch_cpu.dll, c10.dll, LibTorchSharp.dll, …) is Windows-only.
  • ~430 MB of disk space for the bundled Silero models + libtorch runtime (shipped inside the package, so the download is one-time).

Install

Install via Thunderstore / r2modman / Gale, or manually unzip the package and copy BepInEx/plugins/Broheim-SileroTTS/ into your Valheim BepInEx/plugins/ directory.

On first launch the mod generates BepInEx/config/Broheim.SileroTTS.cfg with sensible defaults (Russian / xenia, chat + center narration on).


Configuration — BepInEx/config/Broheim.SileroTTS.cfg

Section [Voice]

Setting Default Description
Language Russian Bundled Silero model: Russian (v4_ru, auto-stress + ё, 5 voices), English (v3_en, 119 voices) or German (v3_de, 5 voices, umlaut handling).
Speaker xenia Speaker name for the chosen language (see list below).

Valid Speaker per language

  • Russian: xenia, aidar, baya, kseniya, eugene
  • English: en_0en_117 — curated subset: en_0, en_20, en_27, en_42, en_46, en_70, en_80, en_91, en_48, en_116, en_82, en_67, en_95 (any en_N index is accepted).
  • German: bernd_ungerer, eva_k, friedrich, hokuspokus, karlsson

Section [Triggers]

Setting Default Description
NarrateChat true Speak incoming chat messages.
SkipOwnChat true Do not speak your own outgoing chat messages. Turn off to hear yourself (useful when testing a voice).
AnnounceSpeaker false Prepend the speaker name and verb to chat narration (e.g. "Haldor said in chat: ..."). Off = voice only the message body.
NarrateCenter true Speak center-screen messages (Huginn tips, boss defeats, event starts).
NarrateRunes false Speak rune, raven and intro/tutorial text.
NarrateNpc false Speak NPC dialogue, positioned near the speaker.
NarrateDreams false Speak the dream/portal text shown between sessions.

How it works

Silero runs entirely inside the mod via TorchSharp — the same libtorch runtime that Python uses, but loaded directly from .NET. The Silero TorchScript .pt models are loaded directly by libtorch, which bypasses the well-known ONNX exporter failures on Silero's dynamic prim::If runtime checks. No ONNX, no Python, no sidecar process.

Text preprocessing is a hand-ported C# implementation, verified bit-identical against the original Python apply_tts pipeline:

  • Russian: automatic stress assignment, ё insertion, n-gram stress embedding, MLP stress model, digits → Russian words (e.g. 3.14«три запятая один четыре») and Latin → Cyrillic transliteration so English words/names are attempted instead of silently skipped.
  • English / German: lowercasing, symbol filtering, ASCII/umlaut mapping, per-language speaker/symbol maps.

The neural tts_model (duration and pitch predictors, encoder, decoder and vocoder) runs natively in libtorch from silero_assets/<lang>/tts_runner.pt.

silero_assets/ layout (shipped with the mod):

silero_assets/
  ru/tts_runner.pt        v4_ru neural model
  ru/silero_accentor.dat  RU accentor: n-gram, MLP, symbols, exceptions
  en/tts_runner.pt        v3_en
  en/preprocess.dat       EN symbol/speaker map
  de/tts_runner.pt        v3_de
  de/preprocess.dat       DE symbol/speaker/umlaut map
  TorchSharp.dll + libtorch-cpu-win native DLLs (shared, ~256 MB)

Bundled .NET Standard 2.0 facades resolve TorchSharp's managed dependency closure under Valheim's Mono runtime — that is what makes "no client install" possible.

Troubleshooting

  • No sound. Confirm Language and Speaker match (e.g. don't set a German speaker with Language = Russian). Relaunch after changing the voice.
  • Numbers or English words skipped (RU). The RU accentor expands digits to words and transliterates Latin before synthesis; if something specific is still skipped it is usually an unsupported symbol in the accentor's table.
  • Slow first utterance. The first synthesis warms up libtorch (JIT + native library init). Subsequent utterances are fast.
  • Want a different voice. Pick another Speaker for the current language, or switch Language.

Credits & acknowledgements

  • Silero TTS models by the Silero team.
  • TorchSharp — Microsoft's .NET bindings for libtorch / PyTorch.
  • Valheim chat/rune/NPC/center/dream narration via Harmony patches on the game's public API.

This mod was inspired by Azumatt's TextToSpeech (https://thunderstore.io/c/valheim/p/Azumatt/TextToSpeech/) — the idea of speaking Valheim's chat, runes, raven and NPC text aloud. All code in this package is written from scratch; big thanks to Azumatt for the original concept and for his work on the Valheim modding community.

Source code and releases: https://github.com/alexkuryshko/Broheim-SileroTTS

See CHANGELOG.md for the version history.

CHANGELOG

Changelog

1.3.3

  • Separate RuneStonesVolume channel. Rune stones (TextViewer.ShowText style 0) now route to a dedicated Channel.RuneStones with its own [Channel Volume] RuneStonesVolume (default 1.0, 0.0–3.0), so rune stones can be quieter than the raven. Raven/intro/tutorial (style 1/2) stay on Channel.Runes. Fixes "rune stones too loud" without silencing the raven.
  • Soft clipping (tanh). Replaced hard clipping at ±1.0 with Math.Tanh saturation in WavPlayer. Higher gain now compresses smoothly instead of distorting; vol=1 stays near-linear, vol>=2 pushes into smooth saturation.
  • Normalization target lowered to 0.74 so the volume knob keeps headroom.

1.3.2

  • Sentence chunking. Long narration (raven tutorial, NPC dialogue) is now split into sentence-sized pieces before synthesis (SileroEngine.SplitIntoChunks, max 200 chars/chunk). Each chunk is synthesized as its own utterance and the PCM is concatenated with a 150 ms silence gap. Gives natural pauses between the header and the body and between paragraphs, and keeps each forward pass short so prosody/energy stay strong (long single utterances drifted and went quiet).
  • LineJoin header/body joiner (SpeechHooks). Ensures the header ends with sentence punctuation so it becomes its own chunk with a pause before the body — fixes headers read "merged" (слитно) into the rest of the text. Applied to LoreTextHook (raven/runes/intro) and NpcDialogueHook.

1.3.1

  • Peak normalization. WavPlayer.ToClip now peak-normalizes the decoded PCM to a target of 0.74 (above a 0.01 noise floor) before applying the channel/master volume. Silero often synthesizes RU text at a low peak (~0.1); without normalization the volume multiplier just clipped the few loud peaks while the body stayed inaudible. The raven/runes are now clearly audible at RunesVolume = 2.

1.3.0

  • Voice overlap control — new [Voice] OverlapMode:
    • Queue (default): wait for the current line to finish, then play the next — no overlap. Fixes the raven/text collision.
    • Interrupt: cut off the current line, play the new one immediately.
    • Overlap: let multiple lines mix. Narration is now serialized through a single queue (one synth + one playback at a time).
  • Per-channel volume — new [Channel Volume] section: ChatVolume, CenterVolume, RunesVolume, NpcVolume, DreamsVolume, each 0.0–3.0, multiplied on top of the master [Voice] Volume.
  • Silence trim + first-letters fix — new [Voice] TrimTrailingSilence (default true) cuts the model's long quiet tail so narration is snappy; new [Voice] PreRollMs (default 120) adds a short lead-in so the first phoneme isn't swallowed by the audio source's start-up ramp. This directly fixes "первые буквы проглатываются".
  • Reworked WavPlayer to take volume/pre-roll/trim as parameters; Play2DClip/Play2DTransient/PlaySpatialClip replace the old PlayOnPlayer/PlayAtPoint.

1.2.1

  • Volume control — new [Voice] Volume (default 1.0, range 0.0–3.0). Above 1.0 amplifies the signal (e.g. 1.5 noticeably louder, 2.0 very loud), hard-clipped to avoid distortion. Below 1.0 = quieter. Independent of the game's master volume. Applied at PCM level so the boost works on both the 2D narration and spatial NPC sources.

1.2.0

  • Best male voice by default: Speaker default changed to aidar (the only male voice in v5_4_ru).
  • Tone & speed controls — new [Voice] config entries:
    • Pitch (default 1.0, range 0.5–2.0): < 1.0 lower/rougher/deeper, > 1.0 higher/brighter. Scales the model's per-token pitch contour.
    • Speed (default 1.0, range 0.5–2.0): < 1.0 slower, > 1.0 faster. Scales token-duration (durs_rate).
    • No model retraining or .pt rebuild required — applied at synthesis time.
  • Config descriptions updated for v5_4_ru (4 voices) and the new entries.

1.1.0

  • Russian upgraded to Silero v5_4_ru (newer neural model, 4 voices: kseniya, aidar, baya, xenia; eugene falls back to xenia).
  • Rewrote the RU accentor as a pure-C# port of the v5 AccentorNgram (native-Cyrillic n-gram + stress/ё MLP, 16969 exceptions), verified 1:1 against the original v5 TorchScript accentor on a wide test set.
  • The v5 BERT homograph disambiguation (HomoSolver, 1924 words) is not bundled — homographs use the n-gram-predicted stress. This keeps the package Python/BERT-free; the only behavioural delta vs full v5 SileroStress is on those 1924 homographs.
  • License attribution completed: Silero models (CC BY-NC-SA 4.0, non-commercial), libtorch (BSD-3), TorchSharp + .NET facades (MIT). See LICENSE.md.
  • Digits → Russian words and Latin → Cyrillic transliteration retained.

1.0.0

  • Initial release.
  • Self-contained in-game TTS for Valheim: chat, runes/raven/intro, center-screen messages, dreams and NPC dialogue.
  • Bundled pure-C# Silero neural voices (RU v4_ru, EN v3_en, DE v3_de) running via TorchSharp/libtorch — no Python, no client-side install, no downloads.
  • Russian preprocessing: auto-stress + ё, digits → words, Latin → Cyrillic transliteration.
  • Configurable language/speaker and per-channel narration toggles.