S&box Wiki


The Voice API allows the developer to change various properties and behaviour of voice chat.



You can override the OnVoicePlayed() method in Sandbox.Game to control what happens when other clients' voice data is coming through. Note that OnVoicePlayed is not called for your own client - only other clients.

public override void OnVoicePlayed( Client cl ) { Log.Info( $"{cl.Name} is speaking!" ); VoiceList.Current?.OnVoicePlayed( cl.SteamId, cl.VoiceLevel ); }

Voice UI

Voice List

By default, OnVoicePlayed populates a base UI component called VoiceList (base/UI/VoiceChat) as long as it exists in your game's UI (i.e adding <VoiceList /> in a template or adding the class as a child in C#). By overriding OnVoicePlayed, you could customize what happens when a client hears voice however you choose.


Voice Speaker

VoiceSpeaker is another base UI component that shows when you are speaking instead of others.


Client Properties

You can access various properties on a client pertaining to voice. These allow you to access the voice properties of any client in your game.

// VoiceStereo determines whether voice chat should be global or proximity-based. cl.VoiceStereo = false;


Sandbox.Voice allows you to access additional properties based on the local client's voice.