Repository navigation
hle: synthesize text and SSML with installed Windows voices - #35
Merged
Merged
Conversation
|
Other open pull requests change the same files. Check that they do not do the same work, and agree with their authors on which lands first: the other one will then need a rebase.
This comment is kept up to date automatically and removed when the overlap ends. |
simnJS
requested changes
Nov 24, 2026
simnJS
left a comment
Collaborator
There was a problem hiding this comment.
Thanks, this is a careful piece of work. I reviewed the diff only (it was not run on a title):
- the slot layout, voice struct, callback contract and gender mapping match the public GDK reference;
- handle ownership is clean, and nothing reaches an audio device;
- the supply chain is clean: only the in-tree
xtp-testkitpluswindowsfeatures, each of which is needed; - CI's Windows runner exercised the real voice path;
- the Codex disclosure and your personal sign-off are fine under CONTRIBUTING.
One change before merge:
- Degrade to the empty WAVE on host failures. Today
create(speech.rs:80),create_stream(:133) and the transcoder path (narrator.rs:81, :86-89) return an error where the title used to get S_OK and the empty WAVE. That could happen on a host with a voice but no working Media Foundation (N editions, Server). Since the title path is untested, please log a warning and fall back toSynthesizer::Silent/SILENCE. Keeping the SSML parse error is fine. Please also short-circuit empty or whitespace-only text to the empty WAVE, and add a test for"".
Smaller points, take or leave:
- Mark R6 done in docs/analysis/hle.md (line 177 and the R6 section), as #23 did for R7.
- In the WAVE test, also assert format tag 1 (PCM), the byte rate and the block align. Or rewrite the output into a canonical 44-byte header, so that we don't depend on Media Foundation's WAV writer layout.
- Consider making
SILENCE48 kHz, so that both paths report one format. - The docs give HRESULT_FROM_WIN32(ERROR_NOT_FOUND) for an invalid stream handle; we return E_INVALIDARG for null. Minor.
- Could you check whether the Windows engine fetches external
<audio src>in SSML? If it does, we should strip it, since XTP is offline by design. - FYI: #26 edits the same README "Runtime services" row, so whichever lands second needs a quick re-merge of that line.
simnJS
approved these changes
Nov 24, 2026
simnJS
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @AliceWood, all addressed:
- host failures and blank text fall back to the empty WAVE;
- the not-found HRESULT;
- full PCM assertions;
- SSML
<audio>elements are reduced to their fallback content before synthesis, so nothing is fetched; - R6 marked done.
CI is green. Merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Fixes #7. The accessibility provider used to return a 44-byte empty WAVE for every narration request. It now enumerates installed Windows voices, lets the caller select one or restore the default, and renders plain text and SSML to 48 kHz, 16-bit mono PCM in memory. Each stream owns its audio until the caller closes it.
The review follow-up (
c9ae4cf) returns the original 44-byte, 16 kHz silent WAVE for blank text, unavailable voices, or a failed speech engine or transcoder. Host failures produce a warning. Malformed SSML retains its format error. XTP replaces SSML audio references with their fallback text and markup before calling the synthesizer, so the host never receives the audio source. This uses the Windows XML DOM with external resolution disabled.Depends on: none.
Area
xtp-hlespeech provider and tests, the README, and the R6 status indocs/analysis/hle.md.Tests
I compared upstream
eeb1f03, the original PR22c9206, and the follow-upc9ae4cfon the same Windows host, using debug builds and synthetic inputs. The probe requested “test” as both plain text and an SSML sentence, then read the WAVE through the provider's stream API.With
XTP_REQUIRE=no-voice, all nine tests selected bycargo test --locked -p xtp-hle modules::speech::passed on the follow-up. They exercise an installed Windows voice, the WAVE fields, nested SSML audio fallback, malformed markup, a null stream handle, and a speech engine closed between requests.Empty and whitespace-only plain text returned
0x8000FFFFon22c9206. Onc9ae4cfboth returnS_OKand the 44-byte empty WAVE. Malformed SSML returned0x80131537on both revisions.On
c9ae4cf,cargo xtask pr-check --base origin/mainpassed formatting, both Clippy configurations, asset policy, and commit conventions. Workspace testing stopped in the GPU crate. Eight failing tests matched the upstream run ateeb1f03. A ninth,watch::tests::written_pages_are_reported_to_every_asker, failed once on the follow-up and then passed in the full GPU suite and in isolation on both builds.cargo test --locked -p xtp-hlehad 169 passed, 1 failed, and 2 ignored in the follow-up's unit tests. Upstream had 166 passed, 1 failed, and 2 ignored. In both,modules::xmem::tests::title_calls_succeed_under_open_heapsfailed at the same assertion.cargo xtask pr-checkpasses on my machineNew or changed behaviour has tests that need no game files, or I explain below why it cannot
Ran on a title: no. The comparison used synthetic input.
Provenance
AI assistance: Codex wrote the implementation, tests, and documentation and ran the comparisons. I reviewed and approved commit
22c9206before opening the PR. Codex implemented and tested the follow-up inc9ae4cf.For the follow-up, Codex consulted the maintainer review, the Windows bindings for XML and speech, the public stream-data reference, and W3C's description of fallback content. Stream-data errors · SSML audio semantics
Codex consulted XTP's existing provider and analysis notes, the installed
windowscrate bindings, and Microsoft's public API references for the voice callback, voice metadata, speech synthesis, and stream transcoding. Its information about xcl came from the XTP issue and analysis notes. A search excerpt identified a Windows speech error during testing. No implementation code was taken from those sources. Voice callback · Voice information · Windows voice selection · Stream transcodingChecklist
<area>: <summary>. The PR totals 459 changed lines excludingCargo.lock. The review follow-up adds host-failure handling, offline SSML audio fallback, and regression coverage for both in the speech provider.