Is there a way to create separate Audio Listener(s)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By silinsar
:warning: Old Version Published before Godot 3 was released.

Hi,

as far as I understand godot has the audio listener placed on the viewport. What I would like to know is if there is or will be a separate node for the listener (you don’t always want it in the center of your camera) and if multiple listeners are / will be supported. E.g. you’d hear the positional audio if any of your x listeners is close to the source.

It “sounds” a bit weird to not have the listener where the camera is, unless the avatar of the player is presented in an offset viewport on the screen (so it isn’t directly centered).
I see there is a 3D spatial Listener and some methods for it, however I see none for 2D…

Zylann | 2017-06-16 16:37

That’s exactly the case I want to cover. Having the Listener stuck on the Viewport seems awfully unflexible. Watching this (https://youtu.be/pdvCO97jOQk) probably gives you hundreds of ideas why and when you don’t want the character centered 100% of the time.
You might also have a “free look” feature to detach the camera/viewport completely while still wanting to use sound to notify the player about events near his character / near any of his units.

silinsar | 2017-06-16 19:40

:bust_in_silhouette: Reply From: eons

For Spatial sounds there is a Listener node, you can set one as current listener when you want.

For 2D sound the only option I can think of is to keep the sound node separated from the node it belongs (or make it a Node children so it lose position data) and keep it to a relative distance from the center similar to the distance of the sound origin and the node that “listen”.

Godot 3 will have a more advanced sound options but I have not tested anything yet, there is a request/proposal for a 2D listener too Listener2D · Issue #6517 · godotengine/godot · GitHub

But spatial (3d) Listeners still only support one current listener? Sorry to ask specifically again, the documentation of Listener has no detail on this.

The workaround to make a “global” listener and adjust any audio playback to the relative positions of sources and whatever node(s) you want to listen would certainly possible but I was hoping for a better/easier way to achieve this.

silinsar | 2017-06-16 19:32

It seems that only supports one, I have never tried a complex sound setup.

You could add a request on GH for simultaneous listeners if was not planned for 3.

eons | 2017-06-16 22:30

:bust_in_silhouette: Reply From: AndrewD

THERE IS A new node: Listener2D in 3.5.1 version