AudioListener position not updating...please advise!

Hi folks.

I’m working on a first person sim, which includes an object heirarchy like this to represent the player:

Object3D: playerCage (For rotating camera left and right and moving player)
	Mesh: player mesh (For rendering player when in 3rd person mode)
	Camera: thirdPersonCamera
		Object3D: pitchCage (For rotating camera up and down)
			Camera: firstPersonCamera
		AudioListener: audioListener
	Object3D: stepSoundCage (for containing footstep sounds)
		PositionalAudio: footstepSound01
		PositionalAudio: footstepSound02
		PositionalAudio: footstepSound03
		PositionalAudio: footstepSound04
		PositionalAudio: footstepSound05

Its working well in my sim architecture, but for some reason, the footstep sounds always seem to originate from world position 0, 0, 0. That is to say, once the game begins, as the player walks forward, the volume of the footsteps diminishes. This is contraray to what I’d expect - for the volume to remain constant - as the distance between the audioListener, camera, and footstep sounds is always 0, thanks to the nesting.

I’ve also tried logging world positions in the render loop to debug this, but have found this to be the case:

camera.getWorldPosition().z === audioListener.getWorldPosition().z === playerCage.getWorldPosition().z // true

I’ve tried a bunch of different things to try and fix this but am starting to get a bit desparate. What I’d like to ask is: Are there any gotchas to be aware of when using positional audio that could cause this type of behaviour?

Heres a whistle-stop tour of how I’m leveraging the positional audio objects:

// Create the audio listener
const audioListener = new Three.AudioListener();

// Create a media manager and tell it to load all assets
const mediaManager = new MediaManager({
	assetList, // Array of string paths
const { succeeded: succeededAssets, failed: failedAssets } = await mediaManager.load();

// Inside the media manager, convert URLs to PositionalAudio objects
return new Promise((resolve, reject) => {
	const loader = new Three.AudioLoader();
		audioBuffer => {
			const sound = new Three.PositionalAudio(this.audioListener);
			this.asset = sound;
			this.loaded = true;
		() => {},
		() => {
			this.loaded = false;

// In the player object, create the heirarchy shown above
// Add sounds to stepSoundCage
// Add stepSoundCage to playerCage
    // Add audioListener to playerCage

// Add player object to scene

I’ve noted that

  • All assets load successfully
  • I’ve ensured the app only starts up after a user gesture
  • No errors in the console

Can you please ensure whether the audio context is actually running or not? It should look similar to:


Hi Mugen, thanks for your reply.

I’ve set the app up to log the audioListener 3 seconds after the simulation has finished starting.

It looks ok to me.

Screenshot from 2020-09-19 15-03-15

I wonder if something in my app architecture is causing the error. But as I say, I have looked at it quite carefully and can’t see any use of the Three PositionalAudio / AudioListener that is contrary to whats intended.

I’ll let you know if I manage to resolve it. In the mean time, if you have any suggestions of anything to try, however speculative, that would be fab!

This was a super weird bug…I couldn’t figure out where its coming from, so I just used non-positional audio for that part of the sim and called it done! I might come back to it later! Most likely PEBKAC on my part.

I had the same issue…

Steps to reproduce:

Make container (object3D) to hold the player related stuff
Add camera to the container
Add positional audio to the container
Move the container