Your first voice channel
The server creates voice channels and controls membership, permissions and playback settings. Clients connect to the voice service automatically. Microphone capture and playback follow each player’s voice settings.
Enable the voice service
Section titled “Enable the voice service”The default server configuration runs voice in the game server process:
[voice]enabled = truemode = "embedded"media_port = 27017Clients must be able to reach UDP port 27017, or the port you select here.
Voice uses its own connection, so the game can connect successfully while voice
remains unavailable. The development server setup
already includes these settings. Embedded mode needs no separate voice process
or shared secret. To run voice in its own process, follow
Run a separate voice server.
Create a proximity channel
Section titled “Create a proximity channel”This example creates a proximity channel and adds both connected players and players who join later:
// @ts-check/// <reference types="@revomp/types-server" />import * as revo from 'revo-server';
const proximity = new revo.VoiceChannel({ spatial: true, range: 30 });
/** @param {revo.Player} player */function joinVoice(player) { proximity.addPlayer(player);}
revo.on('playerConnected', joinVoice);for (const player of revo.Player.all) joinVoice(player);
export function stopVoice() { revo.off('playerConnected', joinVoice); proximity.destroy();}Once spawned, members can hear each other within 30 metres in the same dimension. Voice follows the speaker, with distance attenuation handled by GTA. One shared channel can serve all players, with recipients selected separately for each speaker.
spatial: true enables proximity behavior. The constructor defaults to a
non-spatial channel when this option is omitted. New channels are enabled by
default, and addPlayer(player) grants both transmit and listen permissions.
Re-adding a member preserves their current permissions.
For a mod with authentication or character selection, call joinVoice() after
the player is allowed to participate instead of adding them in playerConnected.
That also applies to the loop over existing players.
Membership persists across respawns. Disconnected players are removed
automatically. Use removePlayer(player) when a player should leave the channel
while staying connected. The example’s stopVoice() removes its connection
handler and destroys the channel.
Speak and listen
Section titled “Speak and listen”This setup needs no client script to activate the channel. Automatic selection includes up to 16 channels on which the server permits transmission.
To test it:
- Connect two players, spawn them in the same dimension and stand a few metres apart.
- In the pause menu’s voice settings, enable voice chat, microphone input and listening. Select the intended microphone and use nonzero input and output volumes.
- Use the configured push-to-talk binding, or speak above the activation threshold when voice activation is selected.
The Test Microphone setting plays input locally. Turn it off before testing delivery to the other player. Channel playback excludes the speaker’s own voice.
Microphone transmission stops when the game loses window focus. Background listening follows the player’s mute-on-focus-loss setting. When testing two clients on one PC, keep the speaking client focused and allow background listening on the other.
Check client state
Section titled “Check client state”The client voice object exposes these snapshots:
| Property | Meaning |
|---|---|
connected |
The voice connection has completed its handshake. |
channels |
Enabled channels available to the local player, with their settings and permissions. |
transmitChannels |
Selected channel IDs with transmit permission. Microphone activation is checked separately. |
Channel updates arrive asynchronously. Read these properties again when checking current state. The arrays and channel objects are read-only snapshots.
This example logs the voice connection and channel state:
// @ts-check/// <reference types="@revomp/types-client" />import * as revo from 'revo-client';
export function logVoiceStatus() { revo.log(JSON.stringify({ connected: revo.voice.connected, channels: revo.voice.channels, transmitChannels: revo.voice.transmitChannels, }, null, 2));}If connected stays false, check that voice is enabled and its UDP endpoint is
reachable. If connected but channels is empty, check server membership and the
channel’s enabled state.
An empty transmitChannels list can come from revoked transmit permission or a
script’s explicit channel selection. voice.setTransmitChannels([]) stops
transmission while preserving listening. voice.setTransmitChannels(null)
restores automatic selection. Microphone settings and server permissions still
apply.
If the channel and selection are present but playback is silent, check the speaker’s microphone, the listener’s voice volume or local mute, and the players’ distance and dimensions.