Voice Chat is not attenuating

I am making a multiplayer game in 4.27 blueprint with sessions, with plans for steam integration. After following tutorials, voice chat is working except there’s no attenuation or spatial audio. Voice can be heard across the map. The same attenuation setting works for all non-voice game sounds, so I know the attenuation itself and the audio listeners are functioning correctly. I am testing through packaged builds with 2 computers over lan with push to talk.

I notice my print message for VOIPTalker success only shows once regardless of player count. So my assumption is that the VOIPTalker audio component only spawns for the client, and it sends the voice over the session with positional data included. Setting the VOIPTalker ref to is replicated doesn’t seem to change anything.

I tried looking at the au.3DVisualizers. For some reason whenever I use push to talk it spawns a synth audio component at 0,0 and not on the attached component. I’m having trouble getting access to the audio component of the VOIP talker.

Hi did you find a solution? I’m facing the same problem.

I was able to get this working based on one discord message that I had to dig deep for.

Simply put, whenever a new player joins, both the client and server has to delete and recreate the VOIP talkers with the attenuation settings for each player. Otherwise it will not have any attenuation applied.

1 Like

Are you using Blueprints, if so, could you show how you achieved this?

1 Like

I found the solution on my own but then forgot how I solved it and couldn’t complete this thread. But, I FINALLY remembered!

There were two things I was doing wrong.

  1. In my original code, I thought I was attaching the VOIPTalker to my player character when I casted. However, apparently, the Add VOIPTalker node immediately creates and attaches the component to the blueprint that calls it. This means the Talker was being attached to my controller blueprint and the only thing I was attaching to my character were the settings. I fixed this by moving all my voice chat init into my character blueprint and removing the cast. I also changed from attaching it from my camera to my base component.

  2. Secondly, I also forgot to consider replication. If you think about it, if you have two people in a game, then you need a VOIPTalker for all player characters a client is connected to. But if you create the VOIPTalker once on the client, that can only create one VOIPTalker. To fix this I made a multicast, so every character sends the event to the server, and then the server creates a VOIP for that player for all connected clients.

Here’s how I’m replicating the voice initialization in the character blueprint.

Does the sound from someone talking attenuate though? Like, the volume is affected by distance?

Yes, it does! That’s the entire point of this thread. Before I fixed it, whenever I spoke into my first computer, the second computer could hear me no matter how far apart my pawns were. Now with my fixes, my voice fades out when I make the pawns walk away from each other. Furthermore, it’s now spatialized, so if I’m wearing headphones, I can hear which direction my voice is coming from.

That said, I have only tested on LAN so far, so I need to do some proper testing with actual playtesters at some point. But for now, it seems to be working as intended.

1 Like

@Qeraga Daym, it works for UE 5.2 as well. Thanks a ton!

I never had a problem with this in UE 4.27, but maybe I overlooked something. Either way, multicasting on the player character’s server instance seems to be the way.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.