synthDriverHandler module
- class synthDriverHandler.LanguageInfo(id)
Bases:
StringParameterInfo
Holds information for a particular language
Given a language ID (locale name) the description is automatically calculated.
- class synthDriverHandler.VoiceInfo(id, displayName, language: str | None = None)
Bases:
StringParameterInfo
Provides information about a single synthesizer voice.
- @param language: The ID of the language this voice speaks,
C{None} if not known or the synth implements language separate from voices.
- class synthDriverHandler.SynthDriver(*args, **kwargs)
Bases:
Driver
Abstract base synthesizer driver. Each synthesizer driver should be a separate Python module in the root synthDrivers directory containing a SynthDriver class which inherits from this base class.
At a minimum, synth drivers must set L{name} and L{description} and override the L{check} method. The methods L{speak}, L{cancel} and L{pause} should be overridden as appropriate. L{supportedSettings} should be set as appropriate for the settings supported by the synthesiser. There are factory functions to create L{autoSettingsUtils.driverSetting.DriverSetting} instances for common settings; e.g. L{VoiceSetting} and L{RateSetting}. Each setting is retrieved and set using attributes named after the setting; e.g. the L{voice} attribute is used for the L{voice} setting. These will usually be properties. L{supportedCommands} should specify what synth commands the synthesizer supports. At a minimum, L{IndexCommand} must be supported. L{PitchCommand} must also be supported if you want capital pitch change to work; support for the pitch setting is not sufficient. L{supportedNotifications} should specify what notifications the synthesizer provides. Currently, the available notifications are L{synthIndexReached} and L{synthDoneSpeaking}. Both of these must be supported. @ivar pitch: The current pitch; ranges between 0 and 100. @type pitch: int @ivar rate: The current rate; ranges between 0 and 100. @type rate: int @ivar volume: The current volume; ranges between 0 and 100. @type volume: int @ivar variant: The current variant of the voice. @type variant: str @ivar availableVariants: The available variants of the voice. @type availableVariants: OrderedDict of [L{VoiceInfo} keyed by VoiceInfo’s ID @ivar inflection: The current inflection; ranges between 0 and 100. @type inflection: int
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 = ''
The name of the synth; must be the original module file name. @type: str
- description = ''
A description of the synth. @type: str
- supportedCommands = frozenset({})
The speech commands supported by the synth. @type: set of L{SynthCommand} subclasses.
- supportedNotifications = frozenset({})
The notifications provided by the synth. @type: set of L{extensionPoints.Action} instances
- _configSection = 'speech'
The configuration section where driver specific subsections should be saved. @type: str
- property voice
- property language: str | None
- availableLanguages: Set[str | None]
- classmethod LanguageSetting()
Factory function for creating a language setting.
- classmethod VoiceSetting()
Factory function for creating voice setting.
- classmethod VariantSetting()
Factory function for creating variant setting.
- classmethod RateSetting(minStep=1)
Factory function for creating rate setting.
- classmethod RateBoostSetting()
Factory function for creating rate boost setting.
- classmethod VolumeSetting(minStep=1)
Factory function for creating volume setting.
- classmethod PitchSetting(minStep=1)
Factory function for creating pitch setting.
- classmethod InflectionSetting(minStep=1)
Factory function for creating inflection setting.
- abstract 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_language() str | None
- _set_language(language)
- _get_availableLanguages() Set[str | None]
- _get_voice()
- _set_voice(value)
- _getAvailableVoices() OrderedDict[str, VoiceInfo]
fetches an ordered dictionary of voices that the synth supports. @returns: an OrderedDict of L{VoiceInfo} instances representing the available voices, keyed by ID
- property rate: int
Between 0-100
- _get_rate() int
- _set_rate(value: int)
- property pitch: int
Between 0-100
- _get_pitch() int
- _set_pitch(value: int)
- property volume: int
Between 0-100
- _get_volume() int
- _set_volume(value: int)
- _get_variant()
- _set_variant(value)
- _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
- _get_availableVariants()
- _get_inflection()
- _set_inflection(value)
- pause(switch)
Pause or resume speech output. @param switch: C{True} to pause, C{False} to resume (unpause). @type switch: bool
- initSettings()
Initializes the configuration for this AutoSettings instance. This method is called when initializing the AutoSettings instance.
- loadSettings(onlyChanged=False)
Loads settings for this AutoSettings instance from the configuration. This method assumes that the instance has attributes o/properties corresponding with the name of every setting in L{supportedSettings}. @param onlyChanged: When loading settings, only apply those for which
the value in the configuration differs from the current value.
- _get_initialSettingsRingSetting()
- _abc_impl = <_abc._abc_data object>
- availableVariants
- property inflection
- initialSettingsRingSetting
- property variant
- synthDriverHandler.initialize()
- synthDriverHandler.changeVoice(synth, voice)
- synthDriverHandler._getSynthDriver(name) SynthDriver
- synthDriverHandler.getSynthList() List[Tuple[str, str]]
- synthDriverHandler.getSynth() SynthDriver | None
- synthDriverHandler.getSynthInstance(name, asDefault=False)
- synthDriverHandler.setSynth(name: str | None, isFallback: bool = False)
- synthDriverHandler.findAndSetNextSynth(currentSynthName: str) bool
Returns True if the next synth could be found, False if currentSynthName is the last synth in the defaultSynthPriorityList
- synthDriverHandler.handlePostConfigProfileSwitch(resetSpeechIfNeeded=True)
Switches synthesizers and or applies new voice settings to the synth due to a config profile switch. @var resetSpeechIfNeeded: if true and a new synth will be loaded, speech queues are fully reset first. This is what happens by default. However, Speech itself may call this with false internally if this is a config profile switch within a currently processing speech sequence. @type resetSpeechIfNeeded: bool
- synthDriverHandler.isDebugForSynthDriver()
- synthDriverHandler.synthIndexReached = <extensionPoints.Action object>
Notifies when a synthesizer reaches an index during speech. Handlers are called with these keyword arguments: synth: The L{SynthDriver} which reached the index. index: The number of the index which has just been reached.
- synthDriverHandler.synthDoneSpeaking = <extensionPoints.Action object>
Notifies when a synthesizer finishes speaking. Handlers are called with one keyword argument: synth: The L{SynthDriver} which reached the index.
- synthDriverHandler.synthChanged = <extensionPoints.Action object>
Action that allows components or add-ons to be notified of synthesizer changes. For example, when a system is controlled by a remote system and the remote system switches synth, The local system should be notified about synth parameters at the remote system. @param synth: The new synthesizer driver @type synth: L{SynthDriver} @param audioOutputDevice: The identifier of the audio output device used for this synth. @type audioOutputDevice: str @param isFallback: Whether the synth is set as fallback synth due to another synth’s failure @type isFallback: bool