fix(azure): correct prosody volume format and spurious validation warnings#43
Merged
Conversation
…lns/version warnings (#42) Drop the % suffix from all three prosody volume emission sites so Azure receives the correct absolute format (volume="75") rather than a relative change (volume="75%"). Also reorder prepareSSML so validation runs after processing, removing two spurious warnings that fired on every plain-text call.
Collaborator
Author
Live verificationTested against the real Azure REST API (
Rate and pitch were also verified live — both pass through correctly with no format issues. |
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.
Fixes #42
Changes
1. Volume attribute: drop the
%suffix (3 locations)Files:
src/engines/azure.ts,src/core/ssml-utils.ts,src/core/abstract-tts.tsThe
%suffix in Azure's<prosody>volume attribute has a specific meaning — it is a relative change from the current volume level, not an absolute value:volume="75"volume="75%"volume="-25%"The code was emitting
volume="75%"for aSpeakOptions.volumeof75. Azure would interpret this as "louder by 75%", effectively maximising volume rather than reducing it. SinceSpeakOptions.volumeis already defined as a 0–100 absolute scale, the fix is simply to drop the%— no value conversion needed.2. Validation ordering: move after processing
File:
src/engines/azure.ts(prepareSSML)validateSSMLForEnginewas running on the bare<speak>text</speak>produced bywrapWithSpeakTags, beforeprocessSSMLForEngineandensureAzureSSMLStructurehad added the requiredxmlnsandversionattributes. This caused two warnings to fire on every plain-text synthesis call:Validation now runs after all processing, so warnings only fire if something is genuinely wrong in what Azure actually receives.
Tests
__tests__/azure-ssml.test.tscovers both fixessrc/__tests__/ssml-utils.test.tsandsrc/__tests__/azure-mstts-namespace.test.tsto assert the correct (no-%) volume format