HLE: speak the title's narration with the host's speech synthesizer #3394
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3394
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3394"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@kilolimaVI on GitHub · 2026-11-26 21:52 UTC · original
kilolimaVI:hle/speech-on-main→main· +413 −39 · 2 files · 2 commits · openREADME: "Speech is silent". This is #82 by @permadiego brought onto current main, plus a fix for a crash in it.
What it does: the title's
XSpeechSynthesizercalls go to the Windows speech synthesizer (WinRTSpeechSynthesizer): text and SSML become 16 kHz mono WAV streams the title plays.The fix: #82 created and dropped a synthesizer per line on a thread of its own. Speaking from several threads at once (the title does) crashed the process with
0xc0000409: a stress test of 8 threads × 3 lines crashed on its first run. Here one speech thread owns a single lazily made synthesizer and takes lines from a queue; callers wait up to 10 s for their answer.Merge onto main: one conflict, in
crates/victory-hle/Cargo.toml(main'swindowsfeatures formodules::fidelityfx); both feature sets kept.Checked on
63bcca4, Windows 11, AMD Radeon 780M / Ryzen 7 8845HS, toolchain 1.98.1:cargo test -p victory-hle --lib --locked -- speech: 5 passed (includinglines_spoken_on_many_threads_at_once_all_come_back)cargo clippy -p victory-hle --all-targets --locked -- -D warnings, and with--all-features: cleanNot checked in the title (no game files). Supersedes #82.
AI-assisted (Claude), reviewed and tested by me.
@Dukestar69 on GitHub · 2026-11-26 22:09 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).modules::speech(with SSML stripping, resampling/mixing, and multi-threaded synthesis coverage) works cleanly on Windows.cargo test -p victory-hle --lib modules::speech:: -- --test-threads=1: 5 passed, 0 failed (empty_text_is_an_empty_wave_file,host_audio_is_mixed_and_resampled,lines_spoken_on_many_threads_at_once_all_come_back,ssml_text_without_markup,text_and_ssml_are_spoken_when_a_voice_is_installed).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 22:24 UTC · original · approved these changes
Looks solid. Isolating
SpeechSynthesizeron a dedicated MTA worker thread (crates/victory-hle/src/modules/speech.rs) cleanly avoids polluting title threads' COM apartments and prevents the multi-threaded synthesizer teardown crash, while resetting the synthesizer on error and falling back from malformed SSML toplaintext and silence when unavailable. The added WinRT features incrates/victory-hle/Cargo.toml:41-45stay properly gated under[target.'cfg(windows)'.dependencies]and build under--locked.Verified merged onto
origin/main(63bcca43) on Windows 11 with a host voice installed:cargo xtask policy(191 files ok) andcargo clippy --locked -p victory-hle --all-targets -- -D warnings(both default and--all-features) pass cleanly.cargo test --locked -p victory-hle --lib -- modules::speech::passes 5/5 (0.36 s), exercising live text and SSML synthesis plus 8-thread × 3-call concurrency.DataReadertruncation), malformed SSML fallback to plain text (57,324 bytes) and whitespace-only SSML (44 bytes), FFI null-pointer / short-buffer / idempotent read /close_stream(null)boundaries, and malformed WAV inputs (u32::MAXchunk length, zero channels/rate, 1-sample 48 kHz downsample, trailing bytes).Two minor non-blocking notes:
to_consoleaccepts0xFFFE(WAVE_FORMAT_EXTENSIBLE) withbits == 16without checking thatSubFormatisKSDATAFORMAT_SUBTYPE_PCM(fine for the host synthesizer, which emits PCM, though worth noting if ever fed arbitrary WAVs).lines_spoken_on_many_threads_at_once_all_come_backstill describes creating/dropping a synthesizer per thread rather than routing through the shared worker queue.@kilolimaVI on GitHub · 2026-11-27 12:06 UTC · original
@fuzeofficlal thanks, both notes are addressed in the latest commit:
to_consolenow takesWAVE_FORMAT_EXTENSIBLEonly when itsSubFormatisKSDATAFORMAT_SUBTYPE_PCM; the new testextensible_wave_files_count_only_with_a_pcm_sub_formatchecks a PCM one is read and an IEEE-float one is refused.lines_spoken_on_many_threads_at_once_all_come_backnow describes the shared speech thread.Re-checked on
63bcca4:cargo test -p victory-hle --lib --locked -- speech6 passed; clippy-D warningsdefault and--all-featuresclean.AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.