voicechat.sendaudiopackets Asynchronous

Generate a sine tone and submit a burst of 10 ms audio frames through the active voice sender. Use this to test an audible frequency without preparing a file.

Syntax
Luau
voicechat.sendaudiopackets(
    sample_frequency: number,
    packet_count: number,
    amplitude: number?
) -> number

Parameters

Function parameters
ParameterTypeDescription
sample_frequencynumberTone frequency from 1 through 3900 Hz.
packet_countnumberPositive integer count of 10 ms frames, stored as an unsigned 32-bit value.
amplitudenumber?Optional level above zero through 1; defaults to 0.25.

Returns

number

The number of frames queued.

Usage notes

The burst is submitted at the next valid processed voice frame. All requested frames are submitted together; the call returns before encoding or transmission.

The count storage limit comes from Kawaii, not Roblox. Very large bursts can stall the outgoing audio callback. stop() or a new tone request can interrupt a burst.

The current voice session must be active and Roblox must allow publishing. Extra packets may be dropped or paced by WebRTC or remote receivers.

Example

Example
Luau
voicechat.sendaudiopackets(440, 20, 0.2) -- Twenty 10 ms frames in one burst
print(voicechat.getstatus().tonepacketsremaining)