In-game control of audio levels
You can use the Vivox SDK to allow in-game control for audio input and output levels.
The following list details examples of scenarios in which you should implement in-game control of audio levels:
- A user wants game sounds and voice output to have different volume levels.
- A user wants to adjust the volume of their voice input.
- A user wants to adjust the volume of an entire channel.
- A user wants to adjust the volume of other individuals in a channel with them.
Volume settings adjust the apparent loudness of a device or participant. All volume settings have a settable range between -50 to 50 on a logarithmic scale, with +0db (no change) being at 0. Because it is a logarithmic scale, the usable range is generally between -10 and 25, with 25 tending to result in over modulation on a capture device and possible user discomfort on a headset. Any increase in the volume above the default value can introduce some amount of distortion, although this is less noticeable at lower levels.
Note: We do not recommend that you allow users to increase their capture device volume above 25.
Adjust local user input and output device volume
The Vivox Unity SDK uses the following methods for setting input and output device audio levels:
VivoxService.Instance.SetInputDeviceVolume(int value)
- Sets the client-side volume of the input device (microphone).
- You can set this value to anything between -50 and 50, with negative numbers lowering the volume, and positive numbers raising the volume.
- This value affects all channels.
VivoxService.Instance.SetOutputDeviceVolume(int value)
- Sets the client-side volume for all Vivox voice audio playing through audio devices on a computer.
- You can set this value to anything between -50 and 50, with negative numbers lowering the volume, and positive numbers raising the volume.
- This value affects all channels.
Adjust a channel participant's volume
The Vivox Unity SDK uses the following method for setting the volume of individual players that a user is in a channel with:
VivoxParticipant.SetLocalVolume(int volume)
- Sets the client-side volume for the Vivox voice audio of an individual participant in a channel.
- You can set this value to anything between -50 and 50, with negative numbers lowering participants volume, and positive numbers raising participant volume.
- For information on
VivoxParticipant
objects, refer to the Participant management documentation.
Adjust the volume of a channel
The Vivox Unity SDK uses the following method for setting the volume of a channel:
VivoxService.Instance.SetChannelVolumeAsync(string channelName, int value)
- Sets the client-side volume for all Vivox voice audio playing through a specific channel.
- You can set this value to anything between -50 and 50, with negative numbers lowering the volume of all incoming audio from a channel, and positive numbers raising the volume.