new babylonjs/Speech(speaker, text, speechmarksopt, audioConfig)
Parameters:
Name | Type | Attributes | Default | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|
speaker |
babylonjs/TextToSpeechFeature | The owner of the Speech |
||||||||
text |
string | The text of the speech. |
||||||||
speechmarks |
Array.<Object> |
<optional> |
[] | An array of speechmark objects representing |
||||||
audioConfig |
Object | Object containing audio and url. Properties
|
Extends
Members
(readonly) audio :external:Audio
Gets the playable audio for the speech.
Type:
- Overrides:
(readonly) playing :boolean
Gets the playback state of the audio.
Type:
- boolean
- Overrides:
speechmarkOffset :number
Gets and sets the number of seconds to offset speechmark emission.
Type:
- number
- Overrides:
(readonly) speechmarks :Array.<Object>
Gets a shallow copy of the speechmarks array for the speech.
Type:
- Array.<Object>
- Overrides:
(readonly) text :string
Gets the text of the speech.
Type:
- string
- Overrides:
volume :number
Gets the audio volume for the speech.
Type:
- number
- Overrides:
Methods
cancel()
Cancels playback of the speech at the current time. Cancel the speech promise.
- Overrides:
pause(currentTime)
Pause the speech at the current time.
Parameters:
Name | Type | Description |
---|---|---|
currentTime |
number | Current global time when pause was called. |
- Overrides:
play(currentTime, onFinishopt, onErroropt, onInterruptopt) → {Deferred}
Play the speech from the beginning.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
currentTime |
number | Current global time when play was called. |
|
onFinish |
function |
<optional> |
Optional function to execute once the speech |
onError |
function |
<optional> |
Optional function to execute if the speech |
onInterrupt |
function |
<optional> |
Optional function to execute if the speech |
- Overrides:
Returns:
Resolves once the speech reaches the end of playback.
- Type
- Deferred
resume(currentTime, onFinishopt, onErroropt, onInterruptopt) → {Deferred}
Resume the speech at the current time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
currentTime |
number | Current global time when resume was called. |
|
onFinish |
function |
<optional> |
Optional function to execute once the speech |
onError |
function |
<optional> |
Optional function to execute if the speech |
onInterrupt |
function |
<optional> |
Optional function to execute if the speech |
- Overrides:
Returns:
Resolves once the speech reaches the end of playback.
- Type
- Deferred
stop()
Stop the speech and reset time to the beginning. Resolve the speech promise.
- Overrides:
update(currentTime)
Emit speechmark messages as they are encountered in sync with audio.
Parameters:
Name | Type | Description |
---|---|---|
currentTime |
number | Current global time when update was called. |
- Overrides: