def l(self, args): "Speak a single character (or set of characters) immediately." res = [] res.extend(self._header) if "character_scale" in self._state: res.append(speech.RateCommand(multiplier=self._state["character_scale"])) res.extend(list(speech.getSpellingSpeech("".join(args)))) speech.cancelSpeech() # Flush NVDA's speech queue speech.speak(res, priority=speech.priorities.SpeechPriority.NOW)
def generateBalancerCommands(self, speechSequence): commands = super(_OcPreAPI5SsmlConverter, self).generateBalancerCommands(speechSequence) # The EncloseAllCommand from SSML must be first. yield next(commands) # OneCore didn't provide a way to set base prosody values before API version 5. # Therefore, the base values need to be set using SSML. yield self.convertRateCommand(speech.RateCommand(multiplier=1)) yield self.convertVolumeCommand(speech.VolumeCommand(multiplier=1)) yield self.convertPitchCommand(speech.PitchCommand(multiplier=1)) for command in commands: yield command
def setRate(self, args): "Sets the speech rate to the absolute value given." value = int(args[0]) self._state["rate_offset"] = value - speech.RateCommand().newValue self._buildHeader()
def _buildHeader(self): "Builds the header of TTS commands when state is updated." self._header = [] # Clear out any previous headers. if "rate_offset" in self._state: self._header.append(speech.RateCommand(self._state["rate_offset"]))