Skip to content

Fix Edge online speech with Sec-MS-GEC v2 - #121

Open
dengxibo wants to merge 2 commits into
gexgd0419:masterfrom
dengxibo:codex/fix-edge-sec-ms-gec-v2
Open

dengxibo wants to merge 2 commits into
gexgd0419:masterfrom
dengxibo:codex/fix-edge-sec-ms-gec-v2

Conversation

@dengxibo

Copy link
Copy Markdown

Edge online voices in v0.2.9 fail because the adapter still generates the v1 SHA-256 token. This updates the handshake to Sec-MS-GEC v2 using the implementation in edge-tts 7.3.0, while preserving local natural voices and the existing SAPI event conversion.

Changes

  • Port the modified SHA-256 and CS64 digest, with integer FILETIME rounding and the existing server Date clock correction.
  • Use Sec-MS-GEC-Version=2-143.0.3650.75 and the matching User-Agent.
  • Add Origin, MUID cookie, cache-control and language headers only for the official Edge WebSocket endpoint. Do not generate GEC for URLs without the placeholder.
  • Add offline reference comparisons and a direct-DLL SAPI smoke test that needs no engine registration.
  • Add /p:NaturalVoiceRegisterOutput=false for builds without registration; the existing default remains enabled.

The digest port and pinned reference retain edge-tts's LGPLv3 attribution/license in tests/reference/; the original project code retains its existing MIT license.

Validation

Based on v0.2.9 (7194eca5), which currently matches upstream master:

  • Release x64 and x86 builds succeeded, using v145 with ATL and the x64 host tools.
  • All 318 C++ token vectors matched edge-tts 7.3.0, including five-minute boundaries and uint64 extremes.
  • Edge en-US-AriaNeural worked in both x64 and x86: nonzero PCM, 8 word boundaries, 2 sentence boundaries and 1 bookmark.
  • Edge zh-CN-XiaoxiaoNeural worked in x64: nonzero PCM, 6 word boundaries, 2 sentence boundaries, 1 bookmark and 47 visemes.
  • Local Aria worked in x64: nonzero PCM, 8 word boundaries, 1 bookmark and 31 visemes.
  • Cancellation after 100 ms returned S_OK in approximately 125 ms.
  • AzureSpeechSDKShim and TtsApplication x64 builds succeeded.

No installer, registration or SDK patcher was run during validation. Azure subscription endpoints, XP runtime and ARM64 were not tested. See tests/README.md for reproducible commands and test scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants