From 49f15a1099584415bd124e182637e14468fe4cf7 Mon Sep 17 00:00:00 2001 From: Stio Date: Sat, 1 Aug 2026 20:33:08 +0300 Subject: [PATCH] Fix no audio: send raw SAPI XML instead of a W3C SSML document SpeakInternal wrapped every utterance in a W3C SSML document ( ... ). Inside that document SAPI does not honor the proprietary tag, so the configured voice was never applied and playback silently fell back to the system default voice. When that default is a neural voice (e.g. exposed through NaturalVoiceSAPIAdapter) the embedded engine additionally rejects the markup with SPERR_UNSUPPORTED_FORMAT (0x80045003), so nothing is spoken at all. Send the raw SAPI XML fragment as-is (the Wrath of the Righteous version already does this for its main Speak/SpeakDialog/SpeakPreview paths). This restores voice selection and makes both classic SAPI5 and neural voices audible. Co-Authored-By: Claude Opus 4.8 --- SpeechMod/Voice/WindowsSpeech.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SpeechMod/Voice/WindowsSpeech.cs b/SpeechMod/Voice/WindowsSpeech.cs index 4746891..a9767ab 100644 --- a/SpeechMod/Voice/WindowsSpeech.cs +++ b/SpeechMod/Voice/WindowsSpeech.cs @@ -78,7 +78,11 @@ private string FormatGenderSpecificVoices(string text) private void SpeakInternal(string text, float delay = 0f) { - text = SpeakBegin + text + SpeakEnd; + // Send raw SAPI XML (a "" fragment) as-is. Do NOT wrap it in a W3C + // document: that wrapper makes SAPI + // ignore the proprietary selection (so it falls back to the + // system default voice) and makes neural engines such as NaturalVoiceSAPIAdapter reject + // the markup with SPERR_UNSUPPORTED_FORMAT (0x80045003) -> no audio. if (Main.Settings?.LogVoicedLines == true) Debug.Log(text); WindowsVoiceUnity.Speak(text, Length(text), delay);