Skip to content

Commit 1acae90

Browse files
committed
Added check for rate boost when computing wpm speech rate. Affects lengths of pauses.
1 parent 41476e2 commit 1acae90

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

addon/globalPlugins/MathCAT/MathCAT.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ def ConvertSSMLTextForNVDA(text:str, language:str="") -> list:
101101
synth = getSynth()
102102
_monkeyPatchESpeak()
103103
wpm = synth._percentToParam(synth.rate, 80, 450)
104+
try:
105+
if synth.rateBoost:
106+
wpm *= 3 # a guess based on espeak -- not sure what oneCore does
107+
except AttributeError:
108+
pass # SAPI voices don't have 'rateBoost' attr
109+
104110
breakMulti = 180.0 / wpm
105111
supported_commands = synth.supportedCommands
106112
use_break = BreakCommand in supported_commands
@@ -485,6 +491,7 @@ def patched_speak(self, speechSequence: SpeechSequence): # noqa: C901
485491
if prosody:
486492
textList.append("</prosody>")
487493
text=u"".join(textList)
494+
# log.info(f"\ntext={text}")
488495
# Added saving old rate and then resetting to that -- work around for https://github.com/nvaccess/nvda/issues/15221
489496
# I'm not clear why this works since _set_rate() is called before the speech is finished speaking
490497
synth = getSynth()

0 commit comments

Comments
 (0)