Voice categories and effects
VoiceChannel.effects defines processing for every speaker using the channel.
The settings are sent to listeners, who process the received audio locally.
Client AudioCategory objects add shared playback settings for channels and
other audio assigned to the same category.
Channel effects
Section titled “Channel effects”This example creates a radio channel with distortion followed by compression.
Its playback uses a client category named ProjectRadioVoice:
// @ts-check/// <reference types="@revomp/types-server" />import * as revo from 'revo-server';
const radio = new revo.VoiceChannel({ spatial: false, category: 'ProjectRadioVoice', volume: -3, effects: [ { type: 'distortion', gainDb: -36, edge: 20, centerHz: 1800, bandwidthHz: 2400, lowPassCutoffHz: 3500, }, { type: 'compressor', gainDb: 0, attackMs: 5, releaseMs: 150, thresholdDb: -18, ratio: 4, predelayMs: 0, }, ],});Membership and transmit selection work as described in Radios and calls. Effects apply to both spatial and non-spatial channels.
Supported effect types are distortion, compressor, equalizer, echo,
reverb, chorus, flanger and gargle. A chain holds up to 16 effects and
processes them in array order. Omitted parameters use the effect’s defaults.
Parameter names indicate their units, such as gainDb, centerHz, attackMs
and wetPercent. bandwidthSemitones sets the equalizer’s bandwidth in semitones.
Unknown effect types and out-of-range parameters are rejected.
Client categories
Section titled “Client categories”Create the named category on every client that will receive the channel. This example groups radio playback under a parent voice category and adds a local equalizer:
// @ts-check/// <reference types="@revomp/types-client" />import * as revo from 'revo-client';
const voiceMix = new revo.AudioCategory('ProjectVoice');const radioMix = new revo.AudioCategory('ProjectRadioVoice', voiceMix.name);
/** @type {import('revo-shared').AudioEffect[]} */const radioEffects = [ { type: 'equalizer', centerHz: 1000, bandwidthSemitones: 12, gainDb: -3 },];
radioMix.volume = -6;radioMix.effects = radioEffects;radioMix.volume, radioMix.muted and radioMix.effects affect playback assigned
to ProjectRadioVoice on this client. Parent settings also apply, so
voiceMix.muted = true silences playback in its child categories. These settings
leave outgoing voice and server permissions unchanged.
Category names must be unique on the client. The parent must exist before
creating its child. Custom categories can be created
before AudioCategory.available becomes true, which indicates that GTA audio
is ready. Only the resource that creates a category can modify or destroy it.
AudioCategory.getByName() lets other resources find the category for reading.
An empty channel.category uses the default voice category. Channel effects
still apply, so a custom category is optional when only server-defined effects
are needed.
Processing order
Section titled “Processing order”For each speaker and channel, processing follows this order:
- The channel’s effects, in array order.
- The selected client category’s effects and volume.
- Each parent category’s effects and volume, starting with the immediate parent.
- GTA positional playback and output mixing.
Each playback has independent effect history. A category shares settings across speakers, while echoes and compressors process each speaker separately before mixing. Putting the same effect chain on both the channel and its category applies it twice.
Use channel.effects = [...] or category.effects = [...] to update a chain.
Reading effects returns a copy, so assign a new array to apply edits. Setting
effects = [] clears that chain, with processing at the other levels unchanged.
Changes apply to newly processed audio.
Volume controls
Section titled “Volume controls”| Setting | Where it applies | Range |
|---|---|---|
channel.volume |
This server channel for every listener. | -100 to 0 dB |
category.volume |
Playback using the category or its children on this client. | -100 to 100 dB |
category.native.volume |
Additional GTA mixer gain for the category. | -100 to 0 dB |
voice.setPlayerVolume(player, value) |
One speaker across all channels for this listener. | -100 to 12 dB |
0 dB leaves the level unchanged. Negative values reduce it, and positive
values amplify it. High gain can cause clipping. Parent, category
and channel volume settings combine, and effects may change the resulting level.
The player’s Listening Volume setting still applies to output.
The category.native controls require GTA audio to be available. They apply
through the game mixer in addition to the category’s shared settings.
Positive per-player gain uses peak limiting. The per-player volume and mute
settings are independent. voice.getPlayerLevel() measures received speech
before effects, distance attenuation, local mute and listener volume, so it
remains useful for a talking indicator when playback is quiet or muted.
Category lifetime
Section titled “Category lifetime”Keep categories available while their channels are in use. category.destroy()
returns false while child categories or audio playback retain it, including
voice playback. Disable the channel or change its category, allow the change to
reach clients and release playback, then destroy unused children before their
parent.
Changing channel.category leaves its effect chain in place. Clearing the
category name restores the default voice category while retaining channel
effects and volume.