API reference
API reference
Select your platform
No SDKs available
No versions available

TTSService Class

Extends MonoBehaviour, ILogSource
Abstract script for loading and returning text-to-speech clip streams.

Properties

IVLogger Logger[Get]
Static singleton to be used when interacting with a single TTSService
Audio system to be used for obtaining audio clip streams
Runtime cache that assists with the temporary storage of audio clips
Disk cache that assists with the backup and retrieval of audio clips saved to disk.
abstract ITTSWebHandler WebHandler[Get]
abstract ITTSVoiceProvider VoiceProvider[Get]

Events

Static event called whenever any TTSService.Awake is called
Static event called whenever any TTSService.OnDestroy is called

Fields

TTSServiceEvents Events[Get]

Member Functions

Returns error if invalid
Gets the text to be spoken after applying all relevant voice settings.
Parameters
textToSpeak
Text to be spoken by a particular voice
voiceSettings
Voice settings to be used
Returns
Returns a the final text to be spoken
Obtain unique id for clip data using provided text
Creates new clip data or returns existing cached clip
Parameters
textToSpeak
Text to speak
voiceSettings
Voice settings
diskCacheSettings
Disk Cache settings
Returns
Clip data structure
Decode a response node into text to be spoken or a specific voice setting
Parameters
responseNode
Parsed data that includes text to be spoken and voice settings
textToSpeak
The text to be spoken output
voiceSettings
The output for voice settings
Returns
True if decode was successful
Loads a text-to-speech clip using a preset voice id, specified settings and return methods
Parameters
textToSpeak
Text to be spoken in audio
presetVoiceId
Specific id that corresponds to a preset voice setting id
diskCacheSettings
Custom disk cache options
onStreamReady
Callback for stream ready to perform playback
onStreamComplete
Callback for stream complete
Returns
Returns the generated tts clip
Loads a text-to-speech clip using specified settings and return methods
Parameters
textToSpeak
Text to be spoken in audio
voiceSettings
Custom voice options
diskCacheSettings
Custom disk cache options
onStreamReady
Callback for stream ready to perform playback
onStreamComplete
Callback for stream complete
Returns
Returns the generated tts clip
Loads a text-to-speech clip using specified settings and return methods
Parameters
clipData
The clip that will be loaded if needed
onStreamReady
Callback for stream ready to perform playback
onStreamComplete
Callback for stream complete
Returns
Returns an error
Unload all audio clips from the runtime cache
Force a runtime cache unload
Obtain a clip from the runtime cache, if applicable
Obtain all clips from the runtime cache, if applicable
Whether a specific clip should be cached
Parameters
clipData
Clip data
Returns
True if should be cached
Get disk cache
Parameters
textToSpeak
Text to be spoken in clip
clipID
Unique clip id
voiceSettings
Custom voice settings
diskCacheSettings
Custom disk cache settings
Returns
Perform a download for a audio clip
Parameters
textToSpeak
Text to be spoken in clip
presetVoiceId
Specific voice id
diskCacheSettings
Custom disk cache settings
onDownloadComplete
Callback when file has finished downloading
Returns
Generated clip data
Perform a download for a audio clip
Parameters
textToSpeak
Text to be spoken in clip
voiceSettings
Custom voice settings
diskCacheSettings
Custom disk cache settings
onDownloadComplete
Callback when file has finished downloading with success or error
Returns
Generated clip data
Perform a download for a audio clip
Parameters
textToSpeak
Text to be spoken in clip
voiceSettings
Custom voice settings
diskCacheSettings
Custom disk cache settings
Returns
Any errors that occured during the download process
Return all preset voice settings
Return preset voice settings for a specific id

Protected Functions

virtual void Awake ( )
virtual void Start ( )
virtual void OnEnable ( )
virtual void OnDisable ( )
Sets listeners to add or remove
Obtains a script implementing a specific interface on this game object
Obtains a script implementing an interface or generates one if not found.
virtual void OnDestroy ( )
Obtain unique id for clip data with text that has already been passed through GetFinalText
virtual void SetClipLoadState
( TTSClipData clipData,
TTSClipLoadState loadState )
Called when runtime cache adds a clip
Parameters
clipData
Called when runtime cache unloads a clip
Parameters
clipData
Clip to be unloaded
Did you find this page helpful?
Thumbs up icon
Thumbs down icon