Crowd Audio
Last updated
Was this helpful?
Last updated
Was this helpful?
MSquared provides large-scale, spatialised voice chat between players, alongside broadcast channels which allow for channel-based non spatialised (2D) audio.
The audio system consists of three parts:
The spatial audio Unreal plugin. This integrates the system with Unreal and provides an API to game code.
The audio client. This is a DLL that provides engine-agnostic processing functionality, and provides an interface to the connection between the client and the audio server.
The audio server. The server receives audio from each client, performs processing and aggregation, and then sends the mixed audio back to each client.
The character used in the example map, BPM_M2Example_PlayerCharacter
, uses an example BP crowd audio component BPMC_CrowdAudio
which enables the player to be able to use voice chat in game. Take a look at the BP logic inside this component to see how BP logic and interact with the audio API in the Unreal plugin to use voice chat.
Voice chat can be enabled either by pressing the button in the UI, or using the corresponding shortcut
C for regular spatial voice chat
This is "push to talk", not a toggle.
To use the loudspeaker you can stand on the pedestal in the Example map and speak. Loudspeaker is an example of broadcast audio.
It is also possible to configure the global mic to be available to certain players by granting them the Capabilities.Voice.VoiceLoudspeaker
capability. This is off by default and you will need to set up your own HUD UI and input logic to use this.
Roles with the Capabilities.Voice.VoiceToggle
capability can instead press to toggle.
Even if you are using toggle mode, holding the button down will be treated as push to talk. (If you hold for longer than the EnterPushToTalkDelay
of 0.25 seconds).
Crowd Audio has a large number of settings that allow you to control parts of the preprocessor, replication, aggregation, and other parts of the audio flow. Some features that you can configure include:
Broadcast channels
Reverb
Occlusion
Volume normalisation
Muting specific players
Disabling spatial audio for specific clients
Voice Chat is powered by the Crowd Audio system. Typically this is intended for spatial voice. However, it also handles 2D voice chat, using broadcast channels:
This is the way that the Crowd Audio system handles different "channels" for communication.
It is controlled via the following (on the CrowdAudioComponent
):
Add/RemoveSubscribedBroadcastChannels
- controls which broadcast channels you are listening to
Add/RemoveAvailableBroadcastChannels
- controls which broadcast channels you are allowed to talk in.
SetSelectedBroadcastChannel
- sets the channel that you are talking in (must be available)
SetVoiceInputEnabled(bEnabled, bBroadcast)
- controls whether you are talking or not. If bBroadcast
is true, you will use your selected broadcast channel. If not, you will use spatial voice.
When someone talks on "loudspeaker", they are using the global broadcast channel (0), which everyone is subscribed to.
Broadcast channels will allow you to implement things like team-specific voice chat or direct voice comms between specific individuals.
Clients can be configured to locally mute individual other clients' spatial audio. You can do this via the following API on the CrowdAudioComponent
:
AddMutedSourceId
RemoveMutedSourceId
You can obtain the speech source id to mute with GetSpeechSourceId
on the target's CrowdAudioComponent.
Note that each additional muted user requires the audio server to do additional computation per tick. This isn't noticeable with low numbers of muted users or at low scale, but you should keep the number of muted sources per player to below 10 in high scale (>5,000) deployments to ensure good audio server performance.
All other settings can be adjusted via the FCrowdAudioSettings
struct or via LiveConfig.
To adjust crowd audio settings in BPs, you need to set the Settings
struct in the CrowdAudioComponent. Note that this will set all of the values to the defaults, so if you want to keep any changes that have been made, you need to make sure to reapply those.
Settings here are generally not applied globally, and will only affect what the local client outputs and receives.
You can also adjust settings via LiveConfig, which will be applied globally. To do this, find the CrowdAudioSettings in LiveConfig and enable UpdateSettingsInTick
, which will enable live config updates for crowd audio.
Note that this will override any custom settings you have applied.
Set Settings
node on the right except for audio occlusion, where I pass in my own audio occlusion settings struct.