Reference API Roblox

Engine API

Website

Related

Reference API Roblox

AudioTextToSpeech

Plays text as speech audio.

Member index 20

HistoryMember
726IsLoaded: bool
726IsPlaying: bool
726Looping: bool
726Pitch: float
726PlaybackSpeed: float
726Speed: float
664Text: string
726TimeLength: double
726TimePosition: double
664VoiceId: string
726Volume: float
664GetConnectedWires(pin: string): Instances
664GetWaveformAsync(timeRange: NumberRange, samples: int): Array
664LoadAsync(): AssetFetchStatus
664Pause(): null
664Play(): null
664Unload(): null
664Ended()
664Looped()
664WiringChanged(connected: bool, pin: string, wire: Wire, instance: Instance)
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Description

AudioTextToSpeech is used to play text as speech audio. It provides a single Output pin which can be connected to other pins via Wires.

Roblox uses the following formula to throttle requests for this API based on the number of players in your experience: max requests per minute per experience = 1 + (6 * number_of_concurrent_users). You can purchase additional usage using Extended Services.

For a more in-depth look, see Text-to-speech.

History 34

Members 20

Ended

Parameters (0)
No parameters.

Fires after the AudioTextToSpeech object has completed playback and paused. Note this event will not fire for audio with Looped set to true since it continues playing upon reaching its end. This event will also not fire when the audio is paused before playback has completed; for this, use AudioTextToSpeech:GetPropertyChangedSignal() on the IsPlaying property.

This event may be used to destroy an AudioTextToSpeech object when it has completed playback.

History 1

GetConnectedWires

Parameters (1)
pinstring
Returns (1)
Instances

Returns an array of Wires that are connected to the specified pin. AudioTextToSpeech has one "Output" pin.

History 1

GetWaveformAsync

Parameters (2)
timeRangeNumberRange
samplesint
Returns (1)
Array

Returns a sampling of the waveform data for the generated text-to-speech audio. This can be used to check the volume of the audio over the course of its duration without playing it.

This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

IsLoaded

TypeDefault
bool

Denotes whether the AudioTextToSpeech object is loaded, buffered, and ready to play. Although uncommon, AudioTextToSpeech objects may have their assets unloaded at runtime if there is extreme memory pressure, in which case IsLoaded will become false.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 2

Tags: [ReadOnly, NotReplicated]

IsPlaying

TypeDefault
bool

Denotes whether the AudioTextToSpeech object is currently playing. This property is read-only, but replicates. To play and stop an AudioTextToSpeech object at runtime, use the Play() and Pause() methods.

History 2

LoadAsync

Parameters (0)
No parameters.
Returns (1)
AssetFetchStatus

A blocking call that begins the generation of speech audio based on the current parameters. It will yield until the speech generation either completes or fails. Status is returned by an AssetFetchStatus value.

This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

Looped

Parameters (0)
No parameters.

Event that fires after the AudioTextToSpeech object loops. This happens when the audio reaches the end of its content and Looping is true.

This event does not fire if the audio is looped manually by changing its TimePosition.

History 1

Looping

TypeDefault
bool

Controls whether the AudioTextToSpeech object loops when exceeding the end of its TimeLength.

History 2

Pause

Parameters (0)
No parameters.
Returns (1)
null

Pauses the AudioTextToSpeech object wherever its TimePosition is. Replicates from server to client.

History 1

Pitch

TypeDefault
float

A value in musical semitones. The pitch of the generated speech audio is shifted from its default value by AudioTextToSpeech.Pitch semitones. Ranges from -12.0 to 12.0.

History 2

Play

Parameters (0)
No parameters.
Returns (1)
null

Plays the AudioTextToSpeech from wherever its TimePosition is. Replicates from server to client.

History 1

PlaybackSpeed

TypeDefault
float

Multiplier controlling how quickly the speech audio will be played, directly controlling its perceived pitch. Ranges from 0 to 20.

History 2

Speed

TypeDefault
float

Multiplier controlling the speed of the generated speech audio. Ranges from 0.5 to 2.0.

History 2

Text

TypeDefault
string

The text to be converted into speech audio by AudioTextToSpeech. The text has a maximum length of 300 characters.

History 1

TimeLength

TypeDefault
double

Denotes the generated speech audio in seconds.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 2

Tags: [ReadOnly, NotReplicated]

TimePosition

TypeDefault
double

Tracks and controls the current position of the playhead within the generated speech audio, in seconds.

History 2

Unload

Parameters (0)
No parameters.
Returns (1)
null

Frees resources by unloading the generated speech audio.

History 1

VoiceId

TypeDefault
string

The voice style to be used by AudioTextToSpeech. A list of available voices and their corresponding VoiceIds can be found in the text-to-speech guide.

History 1

Volume

TypeDefault
float

Volume level which is multiplied onto the output audio stream, controlling how loudly the generated speech audio will be played. Ranges from 0 to 3.

History 2

WiringChanged

Parameters (4)
connectedbool
pinstring
wireWire
instanceInstance

Event that fires after a Wire becomes connected or disconnected, and that Wire is now or was previously connected to a pin on the AudioTextToSpeech and to some other wirable instance.

History 1

Settings