Voice Chat

The PulseOnlineVoice module adds two voice channels per local player:

Channel Who Where it comes from
Party All party members, in the menu and in a match The voice room of the party lobby. The service joins it together with the lobby.
Game Everybody in the current match, with proximity The server of the match hands out the channel and join credentials.

Pulse Online itself has no dependency on a voice service. A voice backend (IPulseOnlineVoiceBackend) does the service-specific part. The PulseOnlineEOS bridge plugin registers one for EOS (EOSVoiceChat, RTC rooms); the Mock backend has a simulated one (Mock voice), so specs and PIE run the whole voice chat without EOS. Without a backend, voice stays off and a warning is logged.

Defaults for co-op with friends, without setup: push to talk on the key V, party members in the same match heard by the distance of their pawns, the voice options in the settings menu of every player, a speaking indicator on the HUD (PulseOnlineHUDBridge).

Setup

  1. Enable PulseOnlineEOS. It enables VoiceChat and EOSVoiceChat. The EOS online subsystem logs the voice user in together with the online user. It needs RTC: bUseEOSRTC=True in [/Script/OnlineSubsystemEOS.EOSSettings] of DefaultEngine.ini (and of the custom config of every client target). Without it EOS logs FEOSVoiceChat::Initialize failed to get interface handles and voice stays off (see the example at the end of this section).
  2. Parties get a voice room by default (Pulse -> Online -> Party -> bPartyVoiceChatDefault, or UPulseOnlineCreatePartyRequest::bVoiceChat).
  3. Game voice on a dedicated server: the client policy of the server in the EOS Developer Portal must allow the RTC admin actions (EOS_RTCAdmin_QueryJoinRoomToken). Without that, the server logs EOS_RTCAdmin_QueryJoinRoomToken failed and nobody gets a match voice channel. On a listen server the host is a game client: the client policy of the game then needs the RTC admin actions (the host hands out the tokens). Without them the match channel stays empty; party members still hear each other over the party channel at full volume (no proximity).
  4. Settings: Project Settings -> Pulse -> Online Voice (UPulseOnlineVoiceSettings).
Setting Default Meaning
bEnableVoice true Master switch. The subsystems are not created when it is off.
DefaultTransmitMode Both Channels the player talks into.
bPushToTalk true Default of the player setting Push To Talk: talk only while the key is held; off: voice activation (open mic).
PushToTalkKey V Default of the player setting Push To Talk Key, read by the voice subsystem itself (no input action). None: the game calls SetPushToTalkPressed.
bRegisterPlayerSettings true The voice options appear in the settings menu of every player.
bMockVoice true The Mock backend has a simulated voice service (Mock voice).
bEnableGameVoice true Servers hand out a match channel.
GameVoiceChannelPrefix Game Channel name <Prefix>_<PULSE_SESSION_KEY>.
bUseInsecureDevTokens false Development only: clients join with IVoiceChat::InsecureGetJoinToken when the server sends no credentials.
ProximityMode VolumeOnly Off, VolumeOnly or Spatialized3D (see below).
ProximityMinDistance / ProximityMaxDistance 300 / 3000 Full volume up to min, silent from max (cm).
ProximityFalloff none Curve over 0..1 (min..max) for VolumeOnly. Linear if unset.
ProximityAttenuation none Attenuation of the speaker components for Spatialized3D.
ProximityUpdateRate 10 Updates per second.
PartyVoiceInMatch Proximity How party members in the same match are heard: by distance over the game channel, or at full volume over the party channel (Party members in the match).
bSilenceSpeakersWithoutPawn true Speakers without a pawn (dead, spectator) are silent in VolumeOnly.
SpatializedBufferSeconds 0.2 Audio buffered per speaker for Spatialized3D.
[/Script/PulseOnlineVoice.PulseOnlineVoiceSettings]
bPushToTalk=False
[/Script/OnlineSubsystemEOS.EOSSettings]
bUseEOSRTC=True

Player settings and push to talk

UPulseOnlineVoicePlayerSettings puts the voice options of each player into the settings menu (PulseFoundation player settings, tab Online, section Voice; bRegisterPlayerSettings turns that off):

Setting Default Meaning
Push to talk bPushToTalk of the project settings (on) Others hear the player only while the key is held; off: open microphone.
Push to talk key PushToTalkKey of the project settings (V) The key. The voice subsystem reads it itself (a Slate input processor): no input action, no mapping context. It counts only while the game window of the player is active and no text box has the focus, so typing a chat message never opens the microphone.
Voice volume 100 % Volume of every voice the player hears.
Microphone volume 100 % Volume of the own microphone.

Games with their own input (an Enhanced Input action, a gamepad button, a touch button) set Push To Talk Key to None in the project settings and call SetPushToTalkPressed from Started and Completed. IsPushToTalkEnabled, GetPushToTalkKey and IsTransmitting (the microphone reaches a channel now) tell the UI what to show.

Using it

Everything goes through UPulseOnlineVoiceSubsystem (a local player subsystem):

UPulseOnlineVoiceSubsystem* voice = LocalPlayer->GetSubsystem<UPulseOnlineVoiceSubsystem>();

// Push to talk from an own input (Push To Talk Key None), e.g. an Enhanced Input action (Started / Completed).
voice->SetPushToTalkPressed(true);

// Only talk to the party, even in the match.
voice->SetTransmitMode(EPulseVoiceTransmitMode::Party);

// Block a player locally (all channels).
voice->SetPlayerMuted(OtherNetId, true);

// Talking indicator.
voice->OnPlayerTalkingChanged.AddDynamic(this, &ThisClass::HandleTalking); // (NetId, Channel, bTalking)

Also available: IsPlayerTalking, IsPlayerMuted, IsInChannel, GetChannelName, SetInputVolume, SetOutputVolume, OnVoiceChannelChanged and the native OnVoiceChangedNative.

Blueprint: Push to talk

  1. Enable Push To Talk in Project Settings → Pulse → Online Voice.
  2. Enhanced Input action PushToTalk Started → Get Local Player Subsystem (Pulse Online Voice Subsystem) → Set Push To Talk Pressed (true).
  3. Completed / Canceled → Set Push To Talk Pressed (false).

Blueprint: Talking indicator and mute button

  1. Widget Construct → Pulse Online Voice Subsystem → Bind Event to On Player Talking Changed (Net Id, Channel, Talking).
  2. Event → find the player’s row by Net Id → set the speaker icon visibility from Talking.
  3. Mute button → Is Player Muted (Net Id) → Not → Set Player Muted (Net Id, result).
  4. With MVVM: bind the icon to bIsTalking of the member view model and the button to Toggle Mute Member instead.

The MVVM view models show the voice state too: UPulseOnlinePartyMemberViewModel::bIsTalking / bIsMuted, UPulseOnlinePartyViewModel::bIsInPartyVoice, bIsInGameVoice, VoiceTransmitMode, ToggleMuteMember and SetTransmitMode.

Voice routes

GetVoiceRoutes() says how the local player hears every other speaker of its channels right now, FindVoiceRoute(NetId) for one (FPulseVoiceRoute): the channel (Party or Game), the volume (0 to 1), the distance to the pawn of the speaker and the reason:

Reason Meaning
Proximity Game channel, the volume follows the distance.
OutOfRange Game channel, farther than ProximityMaxDistance: silent.
NoPawn Game channel, the speaker has no pawn (dead, spectating): silent with bSilenceSpeakersWithoutPawn.
FullVolume Game channel at full volume (ProximityMode Off, or no listener position).
PartyChannel Party channel at full volume.
Muted The local player muted the speaker.

Routes update with the proximity (ProximityUpdateRate); RefreshVoice() updates them at once. With Log LogPulseOnlineVoice Verbose every change is written to the log (Voice route of <player>: <speaker> over Game at 0.42 (Proximity, 1500 cm)), and the cheat PulseOnlineVoice prints them. The speaking indicator of PulseOnlineUI shows only speakers with a route above 0, so a speaker out of range does not light up.

Party members in the match

PartyVoiceInMatch decides how party members in the same match are heard; nobody is heard twice:

  • Proximity (default, co-op with friends): over the game channel by the distance of their pawns, like everybody in the match. Their voice in the party channel is muted meanwhile (SetChannelPlayerMuted on the party room). Members that are still in the menu or in another match stay heard over the party channel at full volume.
  • Party Channel: over the party channel at full volume, wherever they are; their voice in the game channel is muted.

The player talks into both channels (DefaultTransmitMode Both), so a member in the menu hears it over the party channel and a member next to it in the match over the game channel.

Mock voice

With the Mock backend (bMockVoice, on), UPulseOnlineVoiceMockExtension registers a simulated voice service: every local player gets a voice user that is logged in at once, rooms live in memory and are shared by all game instances of the process (the PIE windows hear each other), the party joins the room Party_<party id> with its lobby and servers hand out credentials for the game channel. Nothing is recorded or played: Pulse::Online::Voice::Mock::SetTalking(NetId, bTalking) (cheat PulseOnlineVoice Talk / Stop) simulates speech, which reaches the rooms the player transmits to (transmit mode, push to talk). The mock says who hears whom how loud: GetHeardVolume(Listener, Speaker, OutChannel), and the log line Mock voice: <listener> hears <speaker> in <channel> at <volume> whenever speech starts or a volume changes. Spatialized3D falls back to VolumeOnly with the mock (no audio).

Match voice channel

Server (dedicated or listen)                       Client
PostLogin ──► UPulseOnlineGameVoiceServerSubsystem
              collects the players of one frame
              backend: RequestGameChannelCredentials
              (EOS: EOS_RTCAdmin_QueryJoinRoomToken)
              adds UPulseOnlineVoiceComponent to the PC
              VoiceChannel {Channel, Credentials} ──────► OnRep (owner only)
                                                          UPulseOnlineVoiceSubsystem::JoinGameChannel
                                                          → UPulseOnlineJoinVoiceChannelRequest
                                                            (local player queue, waits for the voice login)
  • The component is replicated owner only, so no client ever sees another player’s token. A listen server host joins directly.
  • The channel name contains the PULSE_SESSION_KEY of the match, so it is unique per match. Without a Pulse session (PIE) a random id per world is used.
  • The client leaves the channel when it leaves the game session (OnGameSessionStateChanged) or joins another match channel. UPulseOnlineLeaveVoiceChannelRequest leaves it by hand.
  • AddPlayerToGameChannel sends the channel again, e.g. after the player controller was replaced.

Proximity

The listener is the audio listener of the local player controller (GetAudioListenerPosition). Speakers are matched to pawns through the replicated player states (PlayerState->GetUniqueId() → voice name of the backend → GetPawn()).

VolumeOnly (default)

Every update, the distance to each speaker’s pawn gives a volume (min/max distance, optional curve). That volume is set for that speaker in the game channel only; EOS: EOS_RTCAudio_UpdateParticipantVolume with the room name. The party channel keeps full volume for members that are not in the match. Volumes are only sent when they change by at least 2 %. EOSVoiceChat applies its own global player volume again after mute changes and new participants, so Pulse sends the proximity volume again after those events.

Party members in the same match are heard once: by default over the game channel with this volume (their party channel voice is muted), with PartyVoiceInMatch Party Channel over the party channel at full volume (their game channel voice is muted); see Party members in the match.

Spatialized3D (optional)

Pulse Online plays the game channel itself. The audio then has direction, attenuation, occlusion and reverb like any other sound:

  1. The game channel’s receive volume is set to 0 (SetChannelReceiveVolume), so the service no longer plays it.
  2. The unmixed audio per speaker (RegisterOnVoiceChatBeforeRecvUnmixedAudioRenderedDelegate) goes into a ring buffer per speaker (down-mixed to mono, older samples dropped on overrun).
  3. A UPulseOnlineVoiceSynthComponent on each speaker’s pawn plays that buffer, resampled to the engine’s rate, with ProximityAttenuation (or min/max distance as linear attenuation).

If the service delivers no per-player audio for two seconds while somebody talks in the game channel, Pulse logs a warning and falls back to VolumeOnly until the next match channel. This is the case if EOS stops delivering the unmixed audio of a room with receive volume 0. In Spatialized3D, speakers without a pawn are silent.

[/Script/PulseOnlineVoice.PulseOnlineVoiceSettings]
ProximityMode=Spatialized3D
ProximityMinDistance=300.000000
ProximityMaxDistance=3000.000000

Own backend

Implement IPulseOnlineVoiceBackend (a service of the backend) and register it from a backend extension (see Backends):

void UMyVoiceExtension::ExtendBackend(UPulseOnlineBackend* InBackend)
{
	InBackend->RegisterService(MakeShared<FMyVoiceBackend>());
}
Function Purpose
GetVoiceUser Logged-in IVoiceChatUser of a local player.
GetPartyChannelName Voice room of the party lobby, empty if none.
GetVoicePlayerName Name the voice service uses for a net id.
SetParticipantVolume Volume of one speaker in one channel (0..1).
SetChannelReceiveVolume Playback volume of a whole channel; return false if not supported (disables Spatialized3D).
RequestGameChannelCredentials Server: join credentials per voice player name.

Blocked players

Party and match members on the block list of Online Safety are muted automatically (after the voice login, when the party changes and when the block list changes); see Chat and Safety.


This site uses Just the Docs, a documentation theme for Jekyll.