Constructor
(abstract) new AbstractTextToSpeechFeature(host, optionsopt)
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
host |
core/HostObject | Host object managing the feature. |
|||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Options that will be sent to Polly for each speech. Properties
|
Properties:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AWS_VERSION |
number | undefined | Gets the version of AWS SDK being |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
POLLY_MIN_NEURAL_VERSION |
string |
<optional> |
'2.503' | Gets the minimum version |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
POLLY_DEFAULTS |
Object | Default values to use with calls to external:Polly. Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
POLLY_VOICES |
Array.<string> |
<optional> |
[] | An array of voices available in |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
POLLY_LANGUAGES |
Object |
<optional> |
{} | An object that maps language names |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
POLLY_LANGUAGE_CODES |
Object |
<optional> |
{} | An object that maps language codes |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
EVENTS |
Object | Built-in messages that the feature emits. When the Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SERVICES |
Object | AWS services that are necessary for the feature Properties
|
Extends
Members
(static, readonly) isReady :boolean
Indicates whether or not the class is capable of generating speech audio. Polly,
Presigner and AWS SDK version number must have been defined using
initializeService.
Type:
- boolean
(readonly) currentSpeech :string
Gets the text of the currently playing speech.
Type:
- string
(readonly) host
Gets the host that manages the feature.
- Overrides:
minEndMarkDuration :number
Gets and sets the The minimum amount of time in seconds that the last
speechmark of each type in a speech can have its duration property set to.
Type:
- number
(readonly) owner
Gets the engine owner object of the host.
- Overrides:
speechmarkOffset :number
Gets and sets the number of seconds to offset speechmark emission.
Type:
- number
volume :number
Gets and sets the volume used for all audio clips played by the speaker.
Type:
- number
(readonly) volumePending :boolean
Gets whether or not the speaker's volume value is currently being tweened.
Type:
- boolean
Methods
(static) initializeService(polly, presigner, version)
Store Polly, Presigner and AWS SDK Version for use across all instances.
Parameters:
Name | Type | Description |
---|---|---|
polly |
external:Polly | Polly instance to use to generate speechmarks. |
presigner |
external:Presigner | Presigner instance to use to generate |
version |
string | Version of the AWS SDK to use to validate voice options. |
discard()
Clean up once the feature is no longer in use. Remove the feature namespace
from the host and remove reference to the host.
- Overrides:
emit(message, valueopt)
Emit feature messages from the host. Feature messages will be prefixed with
the class name of the feature.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to emit. |
|
value |
any |
<optional> |
Optional parameter to pass to listener callbacks. |
- Overrides:
getEngineUserAgentString()
Returns:
The useragent string for the engine you are using, e.g. 'babylonjs/5.1.0'
getVolume() → {number}
Gets the volume used for all audio clips played by the speaker.
Returns:
- Type
- number
installApi()
Adds a namespace to the host with the name of the feature to contain properties
and methods from the feature that users of the host need access to.
- Overrides:
- See:
listenTo(message, callback)
Listen to a feature message from the host object.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | Message to listen for. |
callback |
function | The callback to execute when the message is received. |
- Overrides:
pause()
If a speech is currently playing, pause it at the current time.
pauseVolume() → {boolean}
Pause interpolation happening on the speaker's volume property.
Returns:
- Type
- boolean
play(text, configopt) → {Deferred}
Stop any speeches currently playing and play a new speech from the beginning.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
string | The text of the new speech to play. |
|
config |
Object |
<optional> |
Optional parameters for the speech. |
Returns:
- Type
- Deferred
resume(textopt, configopt) → {Deferred}
Stop any speeches currently playing and resume a new speech from the current
time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
string |
<optional> |
The text of the new speech to play. If undefined and |
config |
Object |
<optional> |
Optional parameters for the speech. |
Returns:
- Type
- Deferred
resumeVolume() → {boolean}
Resume any interpolation happening on the speaker's volume property.
Returns:
- Type
- boolean
setVolume(volume, secondsopt, easingFnopt) → {Deferred}
Updates the volume used for all audio clips played by the speaker over time.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
volume |
number | Target volume value. |
||
seconds |
number |
<optional> |
0 | Amount of time it will take to reach the target |
easingFn |
function |
<optional> |
Easing function used for interpolation. |
Returns:
- Type
- Deferred
stop()
If a speech is currently playing, stop playback and reset time.
stopListening(message, callbackopt)
Stop listening to a message from the host object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | Message to stop listening for. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningByRegexp(regexp, callbackopt)
Stop listening to a message matching the given regular expression from the
host object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
regexp |
Regexp | The regular expression to stop listening for. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningToAll()
Stop listening to all messages.
- Overrides:
update(deltaTime)
Update the currently playing speech.
Parameters:
Name | Type | Description |
---|---|---|
deltaTime |
number | Time since the last update. |
- Overrides: