how do you make a sound only hearable by one person

I want to attached a sound effect to an object and have that sound effect only hear by one of the players in a multi-player game. I have not yet found a way to do that so if anyone has any ideas I would appreciate hearing them. Thanks!

I’d also be interested in this - I can’t really see how to do that.

Hm, can’t this be done by only playing the sound in the clients version of the game instead of letting the server replicate it to everyone?

What about using the Local/Remote node and not having anything set to remote?

What about splitscreen?

So to give this question a somewhat final answer:

In Online/LAN Multiplayer, so with actual Server and Clients, you can limit Sounds and other events to a specific person multiple ways:

  1. You can target them from the Server with a ClientRPC on an Actor they own, such as the PlayerController, PlayerState or PlayerCharacter/Pawn. This guarantees that the event creating the sound will execute only on this one Client.
    This is usually use for UI Sounds, such as a “Double Kill” in a UT match.
  2. You can use 1. also for overlaps if you limit these to “Authority” using a SwitchHasAuthority node in Blueprints.
  3. If you don’t want to use an RPC when an Overlap happens, but you still want to target the local player, you can simply compare, inside of the Actor the Character/Pawn is overlapping, if the “OtherActor” is == to the “GetPlayerPawn/GetPlayerCharacter”, because this node will always return the local player’s Pawn/Character and the comparison will never be true on other players.

Now for Splitscreen, as mightyenigma asked, it’s questionable how much sense it makes to split this. All players are on the screen, all players are using the same audio output, this means playing it on Player 1 or 4 makes no difference if it comes to UI sounds.

For sounds that are relative to a location (3D sound), you should be able to refer to a player via their PlayerController, Pawn/Character or PlayerState, similar to the Online/LAN version. Of course an RPC is not required, as this is all local and all actors are non-networked. If you need to support both at the same time (Online and Splitscreen), then the best solution is to implement the Online/LAN stuff and then see if that works out for Splitscreen for you.

In the end it’s depending on the situation in which the Sound is played. Different situations allow different ways to limit the Sound via RPCs, SwitchHasAuthority, simple comparison of actors etc.
I’d suggest, if any of you have a specific problem with a specific situation, to simply open a new question explaining the situation to then receive a proper, aimed at your problem, answer.

Cheers!

I’m kinda confused as to how you want to make something audible only for one player if in splitscreen everyone shares the same speakers?

Even if you play a sound only for one player (which is totally possible), then the other 3 hear it anyway.

In splitscreen, the only thing I can see being relevant is having the sound play relative to a player’s location. And I just tested that in our splitscreen game:

Sounds next to only one player play correctly on the left/right/front etc., so they are properly relative to the location.

Sounds next to more than one player are calculated out of all location, means if I have a sound left to all players, it’s playing on the left speaker, if I have a sound between them it’s between the players (so both speakers) etc.

In splitscreen it matters because the sound effect is triggered by a moving object’s invisible trigger radius overlapping withthe hearer’s pawn, and has attenuation and location, so it ends up getting duplicated the more players are near the sound. It needs to have location, however.

I worked around it by using PlaySound2D instead of Play Sound at Location, but it would be better if I could make it have a spatial location but be audible only to the intended hearer.

I’m doing this because Android doesn’t do Doppler or any pitch modulation at all, so I am working around THAT by triggering a pre-modulated version of the sound when the bullet approaches the pawn by crossing over that invisible detection bubble.

Hmm that’s a good point. Maybe I’m looking at it wrong. It just seems to clone the sound with a delay though if I play the sound at a location, and I didn’t like the effect.

On the other hand, since I’m only using this workaround on Android, on which I am NOT using splitscreen (only on the PC), then I guess it doesn’t actually matter!