Skip to content
M2O Scripting APIScripting reference
Global objectClient APIGenerated

Voice

const Voice: object

Defined in: client/api.d.ts:2737

Local player’s proximity voice chat settings: on/off, playback volume, hearing range and the push-to-talk binding.

getHearingRange(): number

Reads the local hearing-range limit.

number

Radius in world units, or 0 when the server’s range applies unreduced.

getPushToTalkKey(): string

Reads the push-to-talk binding.

string

Canonical key name, e.g. “v”.

getRange(): number

Reads the server’s proximity range for talkers with no override of their own.

number

Radius in world units.

getVolume(): number

Reads the voice playback volume.

number

Current gain, where 1 is unattenuated.

hasMicrophone(): boolean

Checks whether a capture device opened for this session.

boolean

False when the player has no working microphone, i.e. they are listen-only.

isEnabled(): boolean

Checks whether voice chat is enabled for this player.

boolean

True unless the player turned voice chat off.

isTalking(): boolean

Checks whether the local player is transmitting right now.

boolean

True while push-to-talk is held and the microphone is producing audio.

setEnabled(enabled): void

Turns voice chat on or off. Off closes the microphone and playback devices and tells the server to stop relaying voice to this client.

boolean

Whether voice chat runs at all for this player.

void

setHearingRange(range): void

Narrows how far this player hears others. Can only reduce the server’s range, since a talker beyond it is never relayed.

number

Audibility radius in world units; 0 removes the local limit.

void

setPushToTalkKey(key): void

Rebinds push-to-talk. Unknown key names throw.

string

Case-insensitive key name, using the same names as Key.bind.

void

setVolume(volume): void

Sets the playback volume of incoming voice. Applies to the built-in mixer only.

number

Playback gain, where 1 is unattenuated. Clamped to 0..4.

void