AudioTextToSpeech

Pokaż przestarzałe
Brak możliwości przeglądania

AudioTextToSpeech is used to play text as speech audio. It provides a single Output pin which can be connected to other pins via Wires. This API is still in development and is not yet publicly available.

Przykłady kodu

Outputting Text as Speech

local audioTextToSpeech : AudioTextToSpeech = Instance.new("AudioTextToSpeech")
audioTextToSpeech.Parent = workspace
audioTextToSpeech.Text = "Hello! Converting text into speech is fun!"
audioTextToSpeech.VoiceId = "1"
local deviceOutput = Instance.new("AudioDeviceOutput")
deviceOutput.Parent = workspace
local wire = Instance.new("Wire")
wire.Parent = workspace
wire.SourceInstance = audioTextToSpeech
wire.TargetInstance = deviceOutput
local count = 0
local connection = nil
connection = audioTextToSpeech.Ended:Connect(function()
audioTextToSpeech.Text = "I can count to " .. count .. " because I am very smart"
audioTextToSpeech.VoiceId = "2"
audioTextToSpeech.TimePosition = 0
audioTextToSpeech:Play()
count += 1
if count > 10 then
connection:Disconnect()
end
end)
audioTextToSpeech:Play()

Podsumowanie

Właściwości

  • Tylko do odczytu
    Bez replikacji
    Odczyt równoległy

    Denotes whether the AudioTextToSpeech object is loaded, buffered, and ready to play.

  • Zabezpieczenia na platformie Roblox
    Odczyt równoległy

    Denotes whether the AudioTextToSpeech object is currently playing.

  • Odczyt równoległy

    Controls whether the AudioTextToSpeech object loops.

  • Odczyt równoległy

    Controls the pitch of the generated speech audio, which will be independent of its speed.

  • Odczyt równoległy

    Controls how quickly the speech audio will be played, which controls its pitch.

  • Odczyt równoległy

    Controls the speed of the generated speech audio, which will be independent of its pitch.

  • Odczyt równoległy

    The text to be converted into speech audio by AudioTextToSpeech.

  • Tylko do odczytu
    Bez replikacji
    Odczyt równoległy

    Denotes the length of the generated speech audio.

  • Odczyt równoległy

    Tracks the current position of the playhead within the generated speech audio.

  • Odczyt równoległy

    The voice style to be used by AudioTextToSpeech.

  • Odczyt równoległy

    Controls how loudly the generated speech audio will be played.

Metody

Zdarzenia

Właściwości

IsLoaded

Tylko do odczytu
Bez replikacji
Odczyt równoległy

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.

IsPlaying

Zabezpieczenia na platformie Roblox
Odczyt równoległy

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.

Looping

Odczyt równoległy

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

Pitch

Odczyt równoległy

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.

PlaybackSpeed

Odczyt równoległy

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

Speed

Odczyt równoległy

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

Text

Odczyt równoległy

The text to be converted into speech audio by AudioTextToSpeech.

TimeLength

Tylko do odczytu
Bez replikacji
Odczyt równoległy

Denotes the generated speech audio in seconds.

TimePosition

Odczyt równoległy

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

VoiceId

Odczyt równoległy

The voice style to be used byAudioTextToSpeech.

Volume

Odczyt równoległy

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.

Metody

GetConnectedWires

Instances

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

Parametry

pin: string

Zwroty

Instances

Pause

()

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


Zwroty

()

Play

()

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


Zwroty

()

Unload

()

Frees resources by unloading the generated speech audio.


Zwroty

()

GetWaveformAsync

Wynik

Parametry

timeRange: NumberRange
samples: number

Zwroty

Wynik

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.


Zwroty

Zdarzenia

Ended

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 is may be used to destroy an AudioTextToSpeech object when it has completed playback.


Looped

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.


WiringChanged

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.

Parametry

connected: boolean

Whether the instance got connected or disconnected.

pin: string

The pin on the AudioTextToSpeech that the Wire targets.

wire: Wire

The Wire between the AudioTextToSpeech and the other instance.

instance: Instance

The other instance that is or was connected through the Wire.