x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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!

Product Version: Not Selected
Tags:
more ▼

asked Jul 16 '14 at 05:36 PM in Using UE4

avatar image

mdagreda
65 11 14 15

avatar image G4m4 Jan 12 '15 at 11:52 AM

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

avatar image eXi Jan 12 '15 at 12:37 PM

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?

avatar image JackMenhorn Jan 13 '15 at 05:32 PM

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

avatar image mightyenigma May 17 '19 at 04:25 AM

What about splitscreen?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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!

more ▼

answered May 17 '19 at 07:05 AM

avatar image

eXi
6.8k 332 185 468

avatar image mightyenigma May 20 '19 at 03:50 PM

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.

avatar image eXi May 20 '19 at 04:22 PM

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.

avatar image mightyenigma May 20 '19 at 06:15 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question