synthDrivers package
Submodules
synthDrivers._espeak module
- synthDrivers._espeak._numBytesPushed = 0
Keeps count of the number of bytes pushed for the current utterance. This is necessary because index positions are given as ms since the start of the utterance.
- class synthDrivers._espeak.espeak_EVENT_id
Bases:
Union
- _fields_ = [('number', <class 'ctypes.c_long'>), ('name', <class 'ctypes.c_char_p'>), ('string', <class 'synthDrivers._espeak.c_char_Array_8'>)]
- name
Structure/Union member
- number
Structure/Union member
- string
Structure/Union member
- class synthDrivers._espeak.espeak_EVENT
Bases:
Structure
- _fields_ = [('type', <class 'ctypes.c_long'>), ('unique_identifier', <class 'ctypes.c_ulong'>), ('text_position', <class 'ctypes.c_long'>), ('length', <class 'ctypes.c_long'>), ('audio_position', <class 'ctypes.c_long'>), ('sample', <class 'ctypes.c_long'>), ('user_data', <class 'ctypes.c_void_p'>), ('id', <class 'synthDrivers._espeak.espeak_EVENT_id'>)]
- audio_position
Structure/Union member
- id
Structure/Union member
- length
Structure/Union member
- sample
Structure/Union member
- text_position
Structure/Union member
- type
Structure/Union member
- unique_identifier
Structure/Union member
- user_data
Structure/Union member
- class synthDrivers._espeak.espeak_VOICE
Bases:
Structure
- _fields_ = [('name', <class 'ctypes.c_char_p'>), ('languages', <class 'ctypes.c_char_p'>), ('identifier', <class 'ctypes.c_char_p'>), ('gender', <class 'ctypes.c_byte'>), ('age', <class 'ctypes.c_byte'>), ('variant', <class 'ctypes.c_byte'>), ('xx1', <class 'ctypes.c_byte'>), ('score', <class 'ctypes.c_long'>), ('spare', <class 'ctypes.c_void_p'>)]
- age
Structure/Union member
- gender
Structure/Union member
- identifier
Structure/Union member
- languages
Structure/Union member
- name
Structure/Union member
- score
Structure/Union member
- spare
Structure/Union member
- variant
Structure/Union member
- xx1
Structure/Union member
- synthDrivers._espeak.encodeEspeakString(text)
- synthDrivers._espeak.decodeEspeakString(data)
- class synthDrivers._espeak.BgThread
Bases:
Thread
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is a list or tuple of arguments for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
- run()
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- synthDrivers._espeak._execWhenDone(func, *args, mustBeAsync=False, **kwargs)
- synthDrivers._espeak._speak(text)
- synthDrivers._espeak.speak(text)
- synthDrivers._espeak.stop()
- synthDrivers._espeak.pause(switch)
- synthDrivers._espeak.setParameter(param, value, relative)
- synthDrivers._espeak.getParameter(param, current)
- synthDrivers._espeak.getVoiceList()
- synthDrivers._espeak.getCurrentVoice()
- synthDrivers._espeak.setVoice(voice)
- synthDrivers._espeak.setVoiceByName(name)
- synthDrivers._espeak._setVoiceAndVariant(voice=None, variant=None)
- synthDrivers._espeak.setVoiceAndVariant(voice=None, variant=None)
- synthDrivers._espeak._setVoiceByLanguage(lang)
- synthDrivers._espeak.setVoiceByLanguage(lang)
- synthDrivers._espeak.espeak_errcheck(res, func, args)
- synthDrivers._espeak.initialize(indexCallback=None)
- @param indexCallback: A function which is called when eSpeak reaches an index.
It is called with one argument: the number of the index or C{None} when speech stops.
- synthDrivers._espeak.terminate()
- synthDrivers._espeak.info()
- synthDrivers._espeak.getVariantDict()
synthDrivers._sapi4 module
- class synthDrivers._sapi4.VOICECHARSET
Bases:
c_long
- CHARSET_TEXT = 0
- CHARSET_IPAPHONETIC = 1
- CHARSET_ENGINEPHONETIC = 2
- class synthDrivers._sapi4.LANGUAGEW
Bases:
Structure
- _fields_ = [('LanguageID', <class 'ctypes.c_ushort'>), ('szDialect', <class 'synthDrivers._sapi4.c_wchar_Array_64'>)]
- LanguageID
Structure/Union member
- szDialect
Structure/Union member
- class synthDrivers._sapi4.TTSMODEINFOW
Bases:
Structure
- _fields_ = [('gEngine', <class 'comtypes.GUID.GUID'>), ('szMfgName', <class 'synthDrivers._sapi4.c_wchar_Array_262'>), ('szProductName', <class 'synthDrivers._sapi4.c_wchar_Array_262'>), ('gModeID', <class 'comtypes.GUID.GUID'>), ('szModeName', <class 'synthDrivers._sapi4.c_wchar_Array_262'>), ('language', <class 'synthDrivers._sapi4.LANGUAGEW'>), ('szSpeaker', <class 'synthDrivers._sapi4.c_wchar_Array_262'>), ('szStyle', <class 'synthDrivers._sapi4.c_wchar_Array_262'>), ('wGender', <class 'ctypes.c_ushort'>), ('wAge', <class 'ctypes.c_ushort'>), ('dwFeatures', <class 'ctypes.c_ulong'>), ('dwInterfaces', <class 'ctypes.c_ulong'>), ('dwEngineFeatures', <class 'ctypes.c_ulong'>)]
- dwEngineFeatures
Structure/Union member
- dwFeatures
Structure/Union member
- dwInterfaces
Structure/Union member
- gEngine
Structure/Union member
- gModeID
Structure/Union member
- language
Structure/Union member
- szMfgName
Structure/Union member
- szModeName
Structure/Union member
- szProductName
Structure/Union member
- szSpeaker
Structure/Union member
- szStyle
Structure/Union member
- wAge
Structure/Union member
- wGender
Structure/Union member
- synthDrivers._sapi4.TTSMODEINFO
alias of
TTSMODEINFOW
- class synthDrivers._sapi4.SDATA
Bases:
Structure
- _fields_ = [('pData', <class 'ctypes.c_void_p'>), ('dwSize', <class 'ctypes.c_ulong'>)]
- dwSize
Structure/Union member
- pData
Structure/Union member
- class synthDrivers._sapi4.TTSMOUTH
Bases:
Structure
- _fields_ = [('bMouthHeight', <class 'ctypes.c_byte'>), ('bMouthWidth', <class 'ctypes.c_byte'>), ('bMouthUpturn', <class 'ctypes.c_byte'>), ('bJawOpen', <class 'ctypes.c_byte'>), ('bTeethUpperVisible', <class 'ctypes.c_byte'>), ('bTeethLowerVisible', <class 'ctypes.c_byte'>), ('bTonguePosn', <class 'ctypes.c_byte'>), ('bLipTension', <class 'ctypes.c_byte'>)]
- bJawOpen
Structure/Union member
- bLipTension
Structure/Union member
- bMouthHeight
Structure/Union member
- bMouthUpturn
Structure/Union member
- bMouthWidth
Structure/Union member
- bTeethLowerVisible
Structure/Union member
- bTeethUpperVisible
Structure/Union member
- bTonguePosn
Structure/Union member
- synthDrivers._sapi4.TextSDATA(text)
- class synthDrivers._sapi4.ITTSAttributesW
Bases:
IUnknown
- _iid_: ClassVar[GUID] = GUID("{1287A280-4A47-101B-931A-00AA0047BA4F}")
- PitchGet = <COM method offset 3: WinFunctionType>
- PitchSet = <COM method offset 4: WinFunctionType>
- RealTimeGet = <COM method offset 5: WinFunctionType>
- RealTimeSet = <COM method offset 6: WinFunctionType>
- SpeedGet = <COM method offset 7: WinFunctionType>
- SpeedSet = <COM method offset 8: WinFunctionType>
- VolumeGet = <COM method offset 9: WinFunctionType>
- VolumeSet = <COM method offset 10: WinFunctionType>
- __com_PitchGet = <COM method offset 3: WinFunctionType>
- __com_PitchSet = <COM method offset 4: WinFunctionType>
- __com_RealTimeGet = <COM method offset 5: WinFunctionType>
- __com_RealTimeSet = <COM method offset 6: WinFunctionType>
- __com_SpeedGet = <COM method offset 7: WinFunctionType>
- __com_SpeedSet = <COM method offset 8: WinFunctionType>
- __com_VolumeGet = <COM method offset 9: WinFunctionType>
- __com_VolumeSet = <COM method offset 10: WinFunctionType>
- _methods_: ClassVar[List[_ComMemberSpec]] = [<comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>]
- synthDrivers._sapi4.ITTSAttributes
alias of
ITTSAttributesW
- class synthDrivers._sapi4.ITTSBufNotifySink
Bases:
IUnknown
- _iid_: ClassVar[GUID] = GUID("{E4963D40-C743-11CD-80E5-00AA003E4B50}")
- BookMark = <COM method offset 5: WinFunctionType>
- TextDataDone = <COM method offset 3: WinFunctionType>
- TextDataStarted = <COM method offset 4: WinFunctionType>
- WordPosition = <COM method offset 6: WinFunctionType>
- __com_BookMark = <COM method offset 5: WinFunctionType>
- __com_TextDataDone = <COM method offset 3: WinFunctionType>
- __com_TextDataStarted = <COM method offset 4: WinFunctionType>
- __com_WordPosition = <COM method offset 6: WinFunctionType>
- class synthDrivers._sapi4.ITTSCentralW
Bases:
IUnknown
- _iid_: ClassVar[GUID] = GUID("{28016060-4A47-101B-931A-00AA0047BA4F}")
- AudioPause = <COM method offset 9: WinFunctionType>
- AudioReset = <COM method offset 11: WinFunctionType>
- AudioResume = <COM method offset 10: WinFunctionType>
- Inject = <COM method offset 3: WinFunctionType>
- ModeGet = <COM method offset 4: WinFunctionType>
- Phoneme = <COM method offset 5: WinFunctionType>
- PosnGet = <COM method offset 6: WinFunctionType>
- Register = <COM method offset 12: WinFunctionType>
- TextData = <COM method offset 7: WinFunctionType>
- ToFileTime = <COM method offset 8: WinFunctionType>
- UnRegister = <COM method offset 13: WinFunctionType>
- __com_AudioPause = <COM method offset 9: WinFunctionType>
- __com_AudioReset = <COM method offset 11: WinFunctionType>
- __com_AudioResume = <COM method offset 10: WinFunctionType>
- __com_Inject = <COM method offset 3: WinFunctionType>
- __com_ModeGet = <COM method offset 4: WinFunctionType>
- __com_Phoneme = <COM method offset 5: WinFunctionType>
- __com_PosnGet = <COM method offset 6: WinFunctionType>
- __com_Register = <COM method offset 12: WinFunctionType>
- __com_TextData = <COM method offset 7: WinFunctionType>
- __com_ToFileTime = <COM method offset 8: WinFunctionType>
- __com_UnRegister = <COM method offset 13: WinFunctionType>
- _methods_: ClassVar[List[_ComMemberSpec]] = [<comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>, <comtypes._memberspec._ComMemberSpec object>]
- synthDrivers._sapi4.ITTSCentral
alias of
ITTSCentralW
- class synthDrivers._sapi4.IAudioMultiMediaDevice
Bases:
IUnknown
- _iid_: ClassVar[GUID] = GUID("{B68AD320-C743-11CD-80E5-00AA003E4B50}")
- CustomMessage = <COM method offset 3: WinFunctionType>
- DeviceNumGet = <COM method offset 4: WinFunctionType>
- DeviceNumSet = <COM method offset 5: WinFunctionType>
- __com_CustomMessage = <COM method offset 3: WinFunctionType>
- __com_DeviceNumGet = <COM method offset 4: WinFunctionType>
- __com_DeviceNumSet = <COM method offset 5: WinFunctionType>
- class synthDrivers._sapi4.ITTSEnumW
Bases:
IUnknown
- _iid_: ClassVar[GUID] = GUID("{6B837B20-4A47-101B-931A-00AA0047BA4F}")
- Clone = <COM method offset 6: WinFunctionType>
- Next = <COM method offset 3: WinFunctionType>
- Reset = <COM method offset 5: WinFunctionType>
- Select = <COM method offset 7: WinFunctionType>
- Skip = <COM method offset 4: WinFunctionType>
- __com_Clone = <COM method offset 6: WinFunctionType>
- __com_Next = <COM method offset 3: WinFunctionType>
- __com_Reset = <COM method offset 5: WinFunctionType>
- __com_Select = <COM method offset 7: WinFunctionType>
- __com_Skip = <COM method offset 4: WinFunctionType>
- class synthDrivers._sapi4.ITTSNotifySinkW
Bases:
IUnknown
- _iid_: ClassVar[GUID] = GUID("{C0FA8F40-4A46-101B-931A-00AA0047BA4F}")
- AttribChanged = <COM method offset 3: WinFunctionType>
- AudioStart = <COM method offset 4: WinFunctionType>
- AudioStop = <COM method offset 5: WinFunctionType>
- Visual = <COM method offset 6: WinFunctionType>
- __com_AttribChanged = <COM method offset 3: WinFunctionType>
- __com_AudioStart = <COM method offset 4: WinFunctionType>
- __com_AudioStop = <COM method offset 5: WinFunctionType>
- __com_Visual = <COM method offset 6: WinFunctionType>
- synthDrivers._sapi4.ITTSNotifySink
alias of
ITTSNotifySinkW
synthDrivers.espeak module
- class synthDrivers.espeak.SynthDriver(*args, **kwargs)
Bases:
SynthDriver
Initialize this driver. This method can also set default settings for the driver. @raise Exception: If an error occurs. @postcondition: This driver can be used.
- name = 'espeak'
The name of the synth; must be the original module file name. @type: str
- description = 'eSpeak NG'
A description of the synth. @type: str
- supportedSettings: SupportedSettingType = (<autoSettingsUtils.driverSetting.DriverSetting object>, <autoSettingsUtils.driverSetting.DriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>, <autoSettingsUtils.driverSetting.BooleanDriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>)
Typing for auto property L{_get_supportedSettings}
- supportedCommands = {<class 'speech.commands.BreakCommand'>, <class 'speech.commands.CharacterModeCommand'>, <class 'speech.commands.IndexCommand'>, <class 'speech.commands.LangChangeCommand'>, <class 'speech.commands.PhonemeCommand'>, <class 'speech.commands.PitchCommand'>, <class 'speech.commands.RateCommand'>, <class 'speech.commands.VolumeCommand'>}
The speech commands supported by the synth. @type: set of L{SynthCommand} subclasses.
- supportedNotifications = {<extensionPoints.Action object>, <extensionPoints.Action object>}
The notifications provided by the synth. @type: set of L{extensionPoints.Action} instances
- _defaultLangToLocale = {'chr': 'chr-US-Qaaa-x-west', 'en': 'en-gb', 'fr': 'fr-fr'}
- classmethod check()
Determine whether this driver is available. The driver will be excluded from the list of available drivers if this method returns C{False}. For example, if a speech synthesizer requires installation and it is not installed, C{False} should be returned. @return: C{True} if this driver is available, C{False} if not. @rtype: bool
- property variant
- property rate
- property pitch
- property inflection
- _get_language()
- PROSODY_ATTRS = {<class 'speech.commands.PitchCommand'>: 'pitch', <class 'speech.commands.RateCommand'>: 'rate', <class 'speech.commands.VolumeCommand'>: 'volume'}
- IPA_TO_ESPEAK = {'s': 's', 'ˈ': "'", 'θ': 'T'}
- _processText(text)
- _normalizeLangCommand(command: LangChangeCommand) LangChangeCommand
Checks if a LangChangeCommand language is compatible with eSpeak. If not, find a default mapping occurs in L{_defaultLangToLocale}. Otherwise, finds a language of a different dialect exists (e.g. ru-ru to ru). Returns an eSpeak compatible LangChangeCommand.
- _handleLangChangeCommand(langChangeCommand: LangChangeCommand, langChanged: bool) str
Get language xml tags needed to handle a lang change command. - if a language change has already been handled for this speech, close the open voice tag. - if the language is supported by eSpeak, switch to that language. - otherwise, switch to the default synthesizer language.
- speak(speechSequence: list[SpeechCommand | str])
Speaks the given sequence of text and speech commands. @param speechSequence: a list of text strings and SynthCommand objects (such as index and parameter changes). @type speechSequence: list of string and L{SynthCommand}
- cancel()
Silence speech immediately.
- pause(switch)
Pause or resume speech output. @param switch: C{True} to pause, C{False} to resume (unpause). @type switch: bool
- _rateBoost = False
- RATE_BOOST_MULTIPLIER = 3
- _get_rateBoost()
- _set_rateBoost(enable)
- _get_rate()
- _set_rate(rate)
- _get_pitch()
- _set_pitch(pitch)
- _get_inflection()
- _set_inflection(val)
- _get_volume() int
- _set_volume(volume: int)
- _getAvailableVoices()
fetches an ordered dictionary of voices that the synth supports. @returns: an OrderedDict of L{VoiceInfo} instances representing the available voices, keyed by ID
- _get_voice()
- _set_voice(identifier)
- _onIndexReached(index)
- terminate()
Save settings and terminate this driver. This should be used for any required clean up. @precondition: L{initialize} has been called. @postcondition: This driver can no longer be used.
- _get_variant()
- _abc_impl = <_abc._abc_data object>
- _set_variant(val)
- language: str | None
- property rateBoost
- property voice
- property volume: int
- _getAvailableVariants()
fetches an ordered dictionary of variants that the synth supports, keyed by ID @returns: an ordered dictionary of L{VoiceInfo} instances representing the available variants @rtype: OrderedDict
synthDrivers.mssp module
- class synthDrivers.mssp.SynthDriver(*args, **kwargs)
Bases:
SynthDriver
@param _defaultVoiceToken: an optional sapi voice token which should be used as the default voice (only useful for subclasses) @type _defaultVoiceToken: ISpeechObjectToken
- COM_CLASS = 'speech.SPVoice'
- name = 'mssp'
The name of the synth; must be the original module file name. @type: str
- _abc_impl = <_abc._abc_data object>
- description = 'Microsoft Speech Platform'
A description of the synth. @type: str
synthDrivers.oneCore module
Synth driver for Windows OneCore voices.
- synthDrivers.oneCore.HUNDRED_NS_PER_SEC = 10000000
The number of 100-nanosecond units in 1 second.
- class synthDrivers.oneCore._OcSsmlConverter(defaultLanguage: str, availableLanguages: Set[str])
Bases:
SsmlConverter
Used for newer OneCore installations (OneCore API > 5) where supportsProsodyOptions is True. This allows for changing rate, volume and pitch after initialization.
@param defaultLanguage: language with locale, installed by OneCore (e.g. ‘en_US’) @param availableLanguages: languages with locale, installed by OneCore (e.g. ‘zh_HK’, ‘en_US’)
- _convertProsody(command, attr, default, base=None)
- convertRateCommand(command)
- convertPitchCommand(command)
- convertVolumeCommand(command)
- convertCharacterModeCommand(command)
- convertLangChangeCommand(command: LangChangeCommand) SetAttrCommand | None
- class synthDrivers.oneCore._OcPreAPI5SsmlConverter(defaultLanguage: str, availableLanguages: Set[str], rate: float, pitch: float, volume: float)
Bases:
_OcSsmlConverter
Used for older OneCore installations (OneCore API < 5), where supportsProsodyOptions is False. This means we must initially set a good default for rate, volume and pitch, as this can’t be changed after initialization.
@param defaultLanguage: language with locale, installed by OneCore (e.g. ‘en_US’) @param availableLanguages: languages with locale, installed by OneCore (e.g. ‘zh_HK’, ‘en_US’) @param rate: from 0-100 @param pitch: from 0-100 @param volume: from 0-100
- generateBalancerCommands(speechSequence: list[SpeechCommand | str]) Generator[Any, None, None]
Generate appropriate XmlBalancer commands for a given speech sequence. @rtype: generator
- convertRateCommand(command)
- convertPitchCommand(command)
- convertVolumeCommand(command)
- class synthDrivers.oneCore.OneCoreSynthDriver(*args, **kwargs)
Bases:
SynthDriver
Initialize this driver. This method can also set default settings for the driver. @raise Exception: If an error occurs. @postcondition: This driver can be used.
- MIN_PITCH = 0.0
- MAX_PITCH = 2.0
- MIN_RATE = 0.5
- DEFAULT_MAX_RATE = 1.5
- BOOSTED_MAX_RATE = 6.0
- MAX_CONSECUTIVE_SPEECH_FAILURES = 5
- name = 'oneCore'
The name of the synth; must be the original module file name. @type: str
- description = 'Windows OneCore voices'
A description of the synth. @type: str
- supportedCommands = {<class 'speech.commands.BreakCommand'>, <class 'speech.commands.CharacterModeCommand'>, <class 'speech.commands.IndexCommand'>, <class 'speech.commands.LangChangeCommand'>, <class 'speech.commands.PhonemeCommand'>, <class 'speech.commands.PitchCommand'>, <class 'speech.commands.RateCommand'>, <class 'speech.commands.VolumeCommand'>}
The speech commands supported by the synth. @type: set of L{SynthCommand} subclasses.
- supportedNotifications = {<extensionPoints.Action object>, <extensionPoints.Action object>}
The notifications provided by the synth. @type: set of L{extensionPoints.Action} instances
- classmethod check()
Determine whether this driver is available. The driver will be excluded from the list of available drivers if this method returns C{False}. For example, if a speech synthesizer requires installation and it is not installed, C{False} should be returned. @return: C{True} if this driver is available, C{False} if not. @rtype: bool
- _get_supportsProsodyOptions()
- _get_supportedSettings()
The settings supported by the AutoSettings instance. Abstract.
- property voice
- _maybeInitPlayer(wav)
Initialize audio playback based on the wave header provided by the synthesizer. If the sampling rate has not changed, the existing player is used. Otherwise, a new one is created with the appropriate parameters.
- terminate()
Save settings and terminate this driver. This should be used for any required clean up. @precondition: L{initialize} has been called. @postcondition: This driver can no longer be used.
- cancel()
Silence speech immediately.
- speak(speechSequence: list[SpeechCommand | str]) None
Speaks the given sequence of text and speech commands. @param speechSequence: a list of text strings and SynthCommand objects (such as index and parameter changes). @type speechSequence: list of string and L{SynthCommand}
- _queueSpeech(item: str) None
- classmethod _percentToParam(percent, min, max)
Overrides SynthDriver._percentToParam to return floating point parameter values.
- _get_pitch()
- _set_pitch(pitch)
- _get_volume() int
- _set_volume(volume: int)
- _get_rate()
- _set_rate(rate)
- _rateBoost = False
- _get_rateBoost()
- _set_rateBoost(enable)
- _processQueue()
- _handleSpeechFailure()
- _callback(bytes, len, markers)
- _getVoiceInfoFromOnecoreVoiceString(voiceStr)
Produces an NVDA VoiceInfo object representing the given voice string from Onecore speech.
- _getAvailableVoices()
fetches an ordered dictionary of voices that the synth supports. @returns: an OrderedDict of L{VoiceInfo} instances representing the available voices, keyed by ID
- _isVoiceValid(ID: str) bool
Checks that the given voice actually exists and is valid. It checks the Registry, and also ensures that its data files actually exist on this machine. @param ID: the ID of the requested voice. @returns: True if the voice is valid, False otherwise.
OneCore keeps specific registry caches of OneCore for AT applications. Installed copies of NVDA have a OneCore cache in:
HKEY_CURRENT_USERSoftwareMicrosoftSpeech_OneCoreIsolatedNy37kw9G-o42UiJ1z6Qc_sszEKkCNywTlrTOG0QKVB4
. The caches contain a subtree which is meant to mirror the path:HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeech_OneCore*
.For example:
HKEY_CURRENT_USERSoftwareMicrosoftSpeech_OneCoreIsolatedNy37kw9G-o42UiJ1z6Qc_sszEKkCNywTlrTOG0QKVB4HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeech_OneCoreVoicesTokensMSTTS_V110_enUS_MarkM
refers toHKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeech_OneCoreVoicesTokensMSTTS_V110_enUS_MarkM
.Languages which have been used by an installed copy of NVDA, but uninstalled from the system are kept in the cache. For installed copies of NVDA, OneCore will still attempt to use these languages, so we must check if they are valid first. For portable copies, the cache is bypassed and `HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeech_OneCore` is read directly.
For more information, refer to: https://github.com/nvaccess/nvda/issues/13732#issuecomment-1149386711
- _get_voice()
- _set_voice(id)
- _getDefaultVoice(pickAny: bool = True) str
Finds the best available voice that can be used as a default. It first tries finding a voice with the same language as the user’s configured NVDA language else one that matches the system language. else any voice if pickAny is True. Uses the Windows locale (eg en_AU) to provide country information for the voice where possible. @returns: the ID of the voice, suitable for passing to self.voice for setting.
- pause(switch)
Pause or resume speech output. @param switch: C{True} to pause, C{False} to resume (unpause). @type switch: bool
- _abc_impl = <_abc._abc_data object>
- property pitch
- property rate
- property rateBoost
- supportedSettings: SupportedSettingType
Typing for auto property L{_get_supportedSettings}
- supportsProsodyOptions
- property volume: int
- synthDrivers.oneCore.SynthDriver
alias of
OneCoreSynthDriver
- exception synthDrivers.oneCore.VoiceUnsupportedError
Bases:
RuntimeError
synthDrivers.sapi4 module
- class synthDrivers.sapi4.SynthDriverBufSink(*args, **kw)
Bases:
COMObject
- _com_interfaces_ = [<class 'synthDrivers._sapi4.ITTSBufNotifySink'>]
- ITTSBufNotifySink_BookMark(this, qTimeStamp, dwMarkNum)
- IUnknown_Release(this, *args, **kwargs)
- class synthDrivers.sapi4.SynthDriver(*args, **kwargs)
Bases:
SynthDriver
Initialize this driver. This method can also set default settings for the driver. @raise Exception: If an error occurs. @postcondition: This driver can be used.
- name = 'sapi4'
The name of the synth; must be the original module file name. @type: str
- description = 'Microsoft Speech API version 4'
A description of the synth. @type: str
- supportedSettings: SupportedSettingType = [<autoSettingsUtils.driverSetting.DriverSetting object>]
Typing for auto property L{_get_supportedSettings}
- supportedCommands = {<class 'speech.commands.BreakCommand'>, <class 'speech.commands.CharacterModeCommand'>, <class 'speech.commands.IndexCommand'>}
The speech commands supported by the synth. @type: set of L{SynthCommand} subclasses.
- supportedNotifications = {<extensionPoints.Action object>, <extensionPoints.Action object>}
The notifications provided by the synth. @type: set of L{extensionPoints.Action} instances
- classmethod check()
Determine whether this driver is available. The driver will be excluded from the list of available drivers if this method returns C{False}. For example, if a speech synthesizer requires installation and it is not installed, C{False} should be returned. @return: C{True} if this driver is available, C{False} if not. @rtype: bool
- _fetchEnginesList()
- property voice
- terminate()
Save settings and terminate this driver. This should be used for any required clean up. @precondition: L{initialize} has been called. @postcondition: This driver can no longer be used.
- speak(speechSequence: list[SpeechCommand | str])
Speaks the given sequence of text and speech commands. @param speechSequence: a list of text strings and SynthCommand objects (such as index and parameter changes). @type speechSequence: list of string and L{SynthCommand}
- cancel()
Silence speech immediately.
- pause(switch: bool)
Pause or resume speech output. @param switch: C{True} to pause, C{False} to resume (unpause). @type switch: bool
- removeSetting(name)
- _set_voice(val)
- _get_voice()
- _getAvailableVoices()
fetches an ordered dictionary of voices that the synth supports. @returns: an OrderedDict of L{VoiceInfo} instances representing the available voices, keyed by ID
- _get_rate() int
- _set_rate(val: int)
- _get_pitch() int
- _set_pitch(val: int)
- _get_volume() int
- _abc_impl = <_abc._abc_data object>
- _set_volume(val: int)
- property pitch: int
- property rate: int
- property volume: int
synthDrivers.sapi5 module
- class synthDrivers.sapi5.SPAudioState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- CLOSED = 0
- STOP = 1
- PAUSE = 2
- RUN = 3
- class synthDrivers.sapi5.SpeechVoiceSpeakFlags(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- Async = 1
- PurgeBeforeSpeak = 2
- IsXML = 8
- class synthDrivers.sapi5.SpeechVoiceEvents(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- StartInputStream = 2
- EndInputStream = 4
- Bookmark = 16
- class synthDrivers.sapi5.SapiSink(synthRef: ReferenceType)
Bases:
object
Handles SAPI event notifications. See https://msdn.microsoft.com/en-us/library/ms723587(v=vs.85).aspx
- StartStream(streamNum, pos)
- Bookmark(streamNum, pos, bookmark, bookmarkId)
- EndStream(streamNum, pos)
- class synthDrivers.sapi5.SynthDriver(*args, **kwargs)
Bases:
SynthDriver
@param _defaultVoiceToken: an optional sapi voice token which should be used as the default voice (only useful for subclasses) @type _defaultVoiceToken: ISpeechObjectToken
- supportedSettings: SupportedSettingType = (<autoSettingsUtils.driverSetting.DriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>, <autoSettingsUtils.driverSetting.NumericDriverSetting object>)
Typing for auto property L{_get_supportedSettings}
- supportedCommands = {<class 'speech.commands.BreakCommand'>, <class 'speech.commands.CharacterModeCommand'>, <class 'speech.commands.IndexCommand'>, <class 'speech.commands.LangChangeCommand'>, <class 'speech.commands.PhonemeCommand'>, <class 'speech.commands.PitchCommand'>, <class 'speech.commands.RateCommand'>, <class 'speech.commands.VolumeCommand'>}
The speech commands supported by the synth. @type: set of L{SynthCommand} subclasses.
- supportedNotifications = {<extensionPoints.Action object>, <extensionPoints.Action object>}
The notifications provided by the synth. @type: set of L{extensionPoints.Action} instances
- COM_CLASS = 'SAPI.SPVoice'
- name = 'sapi5'
The name of the synth; must be the original module file name. @type: str
- description = 'Microsoft Speech API version 5'
A description of the synth. @type: str
- classmethod check()
Determine whether this driver is available. The driver will be excluded from the list of available drivers if this method returns C{False}. For example, if a speech synthesizer requires installation and it is not installed, C{False} should be returned. @return: C{True} if this driver is available, C{False} if not. @rtype: bool
- ttsAudioStream = None
- _audioDucker: AudioDucker | None = None
- terminate()
Save settings and terminate this driver. This should be used for any required clean up. @precondition: L{initialize} has been called. @postcondition: This driver can no longer be used.
- _getAvailableVoices()
fetches an ordered dictionary of voices that the synth supports. @returns: an OrderedDict of L{VoiceInfo} instances representing the available voices, keyed by ID
- _getVoiceTokens()
Provides a collection of sapi5 voice tokens. Can be overridden by subclasses if tokens should be looked for in some other registry location.
- _get_rate()
- _get_pitch()
- _get_volume() int
- _get_voice()
- _get_lastIndex()
- _percentToRate(percent)
- _set_rate(rate)
- _set_pitch(value)
- _set_volume(value)
- _initTts(voice=None)
- _set_voice(value)
- _percentToPitch(percent)
- IPA_TO_SAPI = {'s': 's', 'θ': 'th'}
- _convertPhoneme(ipa)
- speak(speechSequence)
Speaks the given sequence of text and speech commands. @param speechSequence: a list of text strings and SynthCommand objects (such as index and parameter changes). @type speechSequence: list of string and L{SynthCommand}
- _abc_impl = <_abc._abc_data object>
- cancel()
Silence speech immediately.
- lastIndex
- property pitch
- property rate
- property voice
- property volume: int
- pause(switch: bool)
Pause or resume speech output. @param switch: C{True} to pause, C{False} to resume (unpause). @type switch: bool
synthDrivers.silence module
- class synthDrivers.silence.SynthDriver(*args, **kwargs)
Bases:
SynthDriver
A dummy synth driver used to disable speech in NVDA.
Initialize this driver. This method can also set default settings for the driver. @raise Exception: If an error occurs. @postcondition: This driver can be used.
- name = 'silence'
The name of the synth; must be the original module file name. @type: str
- description = 'No speech'
A description of the synth. @type: str
- classmethod check()
Determine whether this driver is available. The driver will be excluded from the list of available drivers if this method returns C{False}. For example, if a speech synthesizer requires installation and it is not installed, C{False} should be returned. @return: C{True} if this driver is available, C{False} if not. @rtype: bool
- supportedSettings: SupportedSettingType = frozenset({})
Typing for auto property L{_get_supportedSettings}
- _availableVoices = {'silence': <synthDriverHandler.VoiceInfo object>}
- speak(speechSequence)
Speaks the given sequence of text and speech commands. @param speechSequence: a list of text strings and SynthCommand objects (such as index and parameter changes). @type speechSequence: list of string and L{SynthCommand}
- cancel()
Silence speech immediately.
- _get_voice()
- _abc_impl = <_abc._abc_data object>
- voice: str