概要
屬性
方法
GetConnectedWires(pin: string):{Wire} |
GetWaveformAsync(timeRange: NumberRange,samples: number):{any} |
Pause():() |
Play():() |
Unload():() |
活動
WiringChanged(connected: boolean,pin: string,wire: Wire,instance: Instance):RBXScriptSignal |
範例程式碼
將文本輸出為語音
local audioTextToSpeech: AudioTextToSpeech = Instance.new("AudioTextToSpeech"
)
audioTextToSpeech.Parent = workspace
audioTextToSpeech.Text = "你好!將文本轉換為語音真有趣!"
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 = "我能數到 " .. count .. " 因為我非常聰明"
audioTextToSpeech.VoiceId = "2"
audioTextToSpeech.TimePosition
= 0
audioTextToSpeech:Play()
count += 1
if count > 10 then
connection:Disconnect()
end
end)
audioTextToSpeech:Play()API 參考
屬性
方法
GetWaveformAsync
參數
返回
Pause
AudioTextToSpeech:Pause():()
返回
()
Play
AudioTextToSpeech:Play():()
返回
()
Unload
AudioTextToSpeech:Unload():()
返回
()
活動