How do I change the location spatialized audio is picked up from?

I’m thinking/starting to work on a party game where there would be a group of friends, all holding smartphones or tablets and looking at a table. They would be in a multiplayer server, and all see the same thing on the table. Each player would control a character, and they would battle or something along the lines of that. I plan to use spatialized audio, but from what I can tell, audio is spatialized based on the camera position. I want it to be spatialized based on the character position, so players can actually hear what’s going on around them, no matter where they’re actually standing in the room. I also plan to have a series of speakers around the room matching a 5.1 surround setup, with the receiver plugged into the server computer, and I want these speakers to play game wide events, such as the announcer, and to spatialize other sound effects, and I want this to be consistent with the real life table, no matter what the “dungeon master” is doing on the server computer. Essentially, I want to choose where the audio is spatialized from, instead of it using the camera. Is there a way do do this?

tldr: How can I spatialize audio based on a custom position instead of the camera position?

You can use the Play Sound at Location to play a sound at any location and have players hear it at different levels depending on where they are. This also requires spatial settings enabled for the sound wave.

To make the audio heard from the character’s perspective and not the camera’s (whilst using the camera on the smartphone), you would need to look at the source code for the Player Controller and/or Character classes.
Or, perhaps if you set up a second camera on the character so that it is always following them, then temporarily switched the active camera to the character’s for a close up of gameplay important action sequences, you could also enable them to hear the action from the correct location. As for game sounds the rest of the time when players are operating their smartphones, wouldn’t it make more sense to have them hear sound from their IRL location in relation to the table?

You can override where the audio is picked up by using the “Set Audio Listener Override” node:

You plug your player controller into it and then can either specify a location or just attach it to a component.

4 Likes