Ghi chú phát hành
Học
Lớp công cụ
AudioSpeechToText

*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.


Tóm Tắt
Phương Pháp
Sự Kiện
WiringChanged(connected: boolean,pin: string,wire: Wire,instance: Instance):RBXScriptSignal
Thành viên kế thừa
Mẫu mã
Chuyển đổi giọng nói thành văn bản
local players = game:GetService("Players")
local function connect(src: Instance, dst: Instance)
local wire = Instance.new("Wire", dst)
wire.SourceInstance = src
wire.TargetInstance = dst
end
local textLabel = nil
local stt = nil
local function onCharacterSpawned(player: Player, character: Model)
local input = Instance.new("AudioDeviceInput", player)
input.Player = player
local audioSpeechToText = Instance.new("AudioSpeechToText", character)
audioSpeechToText.Enabled = true
connect(player.AudioDeviceInput, audioSpeechToText)
local screenGui = Instance.new("ScreenGui", player.PlayerGui)
textLabel = Instance.new("TextLabel", screenGui)
textLabel.Text = "Xin chào!"
textLabel.Size = UDim2.fromOffset(160,90)
textLabel.Position = UDim2.fromOffset(20,20)
textLabel.BackgroundTransparency = 0
textLabel.FontFace.Weight = Enum.FontWeight.Bold
textLabel.TextColor3 = Color3.new(1,1,1)
textLabel.TextStrokeColor3 = Color3.new(0,0,0)
textLabel.TextStrokeTransparency = 0.5
audioSpeechToText:GetPropertyChangedSignal("Text"):Connect(function()
if audioSpeechToText.Text ~= '' then
print(audioSpeechToText.Text)
textLabel.Text = audioSpeechToText.Text
audioSpeechToText.Text = ''
end
end)
stt = audioSpeechToText
end
local function onPlayerAdded(player: Player)
if player.Character then
onCharacterSpawned(player, player.Character)
end
player.CharacterAdded:Connect(function()
onCharacterSpawned(player, player.Character)
end)
end
players.PlayerAdded:Connect(onPlayerAdded)
for _, player in players:GetPlayers() do
onPlayerAdded(player)
end
local vad = false
while true do
wait(0.1)
if stt and textLabel then
if(stt.VoiceDetected ~= vad) then
vad = stt.VoiceDetected
print(vad)
if(vad) then
textLabel.BackgroundColor3 = Color3.new(0.7,0,0)
else
textLabel.BackgroundColor3 = Color3.new(0,0,0)
end
end
end
end

Tài Liệu Tham Khảo API
Thuộc Tính
Enabled
Đọc Song Song
Các khả năng: Audio
AudioSpeechToText.Enabled:boolean

Text
Đọc Song Song
Các khả năng: Audio
AudioSpeechToText.Text:string

VoiceDetected
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Các khả năng: Audio
AudioSpeechToText.VoiceDetected:boolean

Phương Pháp
GetConnectedWires
Các khả năng: Audio
AudioSpeechToText:GetConnectedWires(pin:string):{Wire}
Tham Số
pin:string
Lợi Nhuận

Sự Kiện
WiringChanged
Các khả năng: Audio
AudioSpeechToText.WiringChanged(
connected:boolean, pin:string, wire:Wire, instance:Instance
Tham Số
connected:boolean
pin:string
wire:Wire
instance:Instance

©2026 Roblox Corporation. Roblox, logo Roblox và Powering Imagination là các nhãn hiệu đã đăng ký và chưa đăng ký của chúng tôi tại Hoa Kỳ và các quốc gia khác.