Oath speech in the deep warrior voice, cinematic camera, crowd calls your name

Stand von main 730ac6a2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 21:43:38 +01:00
parent 9c433c61ba
commit 0454683fc3
29 changed files with 1249 additions and 57 deletions

51
tools/get_voices.py Normal file
View File

@@ -0,0 +1,51 @@
"""Stimmen für den Ansager/Sprechchor (Namen des Spielers) herunterladen.
Piper-Stimmen (VITS) im Format von sherpa-onnx, offline im Spiel genutzt (Core/NameVoice.cs).
Ziel: Assets/Voices/<de|en|es>/ (model.onnx, tokens.txt, espeak-ng-data/) – nicht in git.
py -3.12 tools/get_voices.py fehlende Stimmen laden
py -3.12 tools/get_voices.py --force alle neu
"""
import os
import shutil
import sys
import tarfile
import tempfile
import urllib.request
BASE = "https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/"
# (Archiv, Sprecher-Nummer): Deutsch mit Gefühlslagen – 1 = wütend, klingt am ehesten nach Arena
VOICES = {
"de": ("vits-piper-de_DE-thorsten_emotional-medium", 1),
"en": ("vits-piper-en_US-ryan-high", 0),
"es": ("vits-piper-es_ES-miro-high", 0),
}
DEST = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Assets", "Voices")
def fetch(lang, name, sid, force):
out = os.path.join(DEST, lang)
have = os.path.join(out, "voice.txt")
if os.path.exists(have) and open(have).readline().strip() == name and not force:
print(f"{lang}: vorhanden"); return
with tempfile.TemporaryDirectory() as tmp:
archive = os.path.join(tmp, name + ".tar.bz2")
print(f"{lang}: lade {name} …", flush=True)
urllib.request.urlretrieve(BASE + name + ".tar.bz2", archive)
with tarfile.open(archive, "r:bz2") as t:
t.extractall(tmp, filter="data")
src = os.path.join(tmp, name)
if os.path.exists(out): shutil.rmtree(out)
os.makedirs(out)
onnx = [f for f in os.listdir(src) if f.endswith(".onnx")][0]
shutil.copy(os.path.join(src, onnx), os.path.join(out, "model.onnx"))
shutil.copy(os.path.join(src, "tokens.txt"), os.path.join(out, "tokens.txt"))
shutil.copytree(os.path.join(src, "espeak-ng-data"), os.path.join(out, "espeak-ng-data"))
open(os.path.join(out, "voice.txt"), "w").write(f"{name}\nsid={sid}\n")
size = sum(os.path.getsize(os.path.join(d, f)) for d, _, fs in os.walk(out) for f in fs)
print(f"{lang}: fertig ({size / 1e6:.0f} MB)")
if __name__ == "__main__":
for lang, (name, sid) in VOICES.items():
fetch(lang, name, sid, "--force" in sys.argv)