概要
属性
方法
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():()
返回
()
活动