Skip to content

Fix SAPI4 prosody regressions#15502

Merged
seanbudd merged 2 commits into
nvaccess:masterfrom
LeonarddeR:sapi4prosody
Sep 25, 2023
Merged

Fix SAPI4 prosody regressions#15502
seanbudd merged 2 commits into
nvaccess:masterfrom
LeonarddeR:sapi4prosody

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

CC @cary-rowen

Link to issue number:

Fixes #15500
Follow up of #15271

Summary of the issue:

Some SAPI4 synthesizers reset all their prosody values to their defaults when they come across prosody in a sequence.

Description of user facing changes

Capital pitch changes no longer cause some SAPI4 voices to reset their rate and volume.

Description of development approach

When a sequence contains any prosody command, for the other prosody commands supported by the synth, we add commands to set them to the currently configured value.

Testing strategy:

Tested str from #15500.
Tested a sequence with a prosody command in the middle of a sequence, ensure that the prosody change is reflected in the speech.

Known issues with pull request:

None known

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@LeonarddeR LeonarddeR requested a review from a team as a code owner September 23, 2023 09:59
@LeonarddeR LeonarddeR requested a review from seanbudd September 23, 2023 09:59
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit ee2ef6db67

@cary-rowen

Copy link
Copy Markdown
Contributor

Thanks @LeonarddeR I confirm this PR has been fixed #15500.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I fixed one additional issue, a generator's bool value is always True.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit b57305ddca

@cary-rowen

Copy link
Copy Markdown
Contributor

Hi @LeonarddeR
There is an additional problem that I don't know if it can be easily fixed. If you need me to create another Issue please let me know.
But this is not a regression bug.

Steps to reproduce

  1. Switch to Sapi4 speech synthesizer(IBMTTS).
  2. Press Windows+B to navigate to the System tray.
  3. Keep pressing the up arrow for 5 seconds or more to quickly cycle focus between items in the tray.
  4. NVDA throws an error, the log is as follows:
Input: kb(laptop):upArrow
ERROR - queueHandler.flushQueue (00:02:59.245) - MainThread (11828):
Error in func cancelSpeech
Traceback (most recent call last):
  File "queueHandler.pyc", line 64, in flushQueue
  File "speech\speech.pyc", line 158, in cancelSpeech
  File "speech\manager.pyc", line 753, in cancel
  File "synthDrivers\sapi4.pyc", line 200, in cancel
  File "monkeyPatches\comtypesMonkeyPatches.pyc", line 32, in __call__
_ctypes.COMError: (-2147418107, '在消息筛选器里时,不可对外调用。', (None, None, None, 0, None))

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I've seen more errors like this. I guess we should just log these errors.

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @LeonarddeR, changes generally look good

try:
self._ttsCentral.AudioReset()
except COMError:
log.error("Error cancelling speech", exc_info=True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why this logs at a different level to the pause changes

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors for pause just passed, I didn't want to introduce logging at the error level for this, though it made sense to me to at least something. Cancel, on the other hand, didn't catch any errors, so it made sense to log them at the error level.

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LeonarddeR

@seanbudd seanbudd merged commit 87d5b5a into nvaccess:master Sep 25, 2023
@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Sep 25, 2023
seanbudd pushed a commit that referenced this pull request Oct 5, 2023
…ce (#15583)

Fixes #15580
Follow up of #15502

Summary of the issue:
In #15502, I fixed some regressions regarding capital pitch changes introduced in #15271. This meant that we'd add prosody commands to every speech sequence to support a specific version of IBM TTS that seemed to need that. However, it introduced a regression in that it was no longer possible to change speech parameters using the gui.

Description of user facing changes
It is again possible to change SAPI4 parameters using the GUI.

Description of development approach
Only add blank prosody commands when there is any prosody in the sequence. IF not, don't do anything.
@LeonarddeR LeonarddeR deleted the sapi4prosody branch August 23, 2025 06:28
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.

regression: Sapi4 speech rate is changed after triggering PitchCommand.

5 participants