Cannot set a listener for Audio3DManager

Greetings. I’m trying to code my first 3d positional audio program but i’m failing at setting the listener or updating its position. My listener is the camera but the sound’s pan and volume does not change relative to the camera’s position. Could you please provide some tips? My code is below:

from math import pi, sin, cos
#import direct.directbase.DirectStart
from direct.showbase.ShowBase import ShowBase
from direct.showbase import Audio3DManager
from direct.task import Task
from import Actor
from direct.interval.IntervalGlobal import Sequence
from panda3d.core import Point3
from panda3d.core import FilterProperties
class MyApp(ShowBase):
	def __init__(self):
		self.scene = self.loader.loadModel("models/environment")
		self.scene.setScale(0.25, 0.25, 0.25)
		self.scene.setPos(-8, 42, 0)
		self.taskMgr.add(self.gameloop, "gameloop")
		self.pandaActor = Actor("models/panda-model",
								{"walk": "models/panda-walk4"})
		self.pandaActor.setScale(0.005, 0.005, 0.005)
		self.pandaActor.setPos(-2, 0, 0)
		# Loop its animation.
		self.pandaActor.loop("walk"), 10, 0)
		self.audio3d = Audio3DManager.Audio3DManager(base.sfxManagerList[0],
		self.audio3d.attachListener(, 0, 0)
		mySound = self.audio3d.loadSfx("models/audio/sfx/GUI_rollover.wav")
		self.audio3d.attachSoundToObject(mySound, self.pandaActor)
		#fp.addReverb(0.6, 0.5, 0.1, 0.1, 0.1)

	def gameloop(self, task):
		#As long as the procedure spinCameraTask() returns the constant Task.cont, the task manager will continue to call it every frame.
		return Task.cont

app = MyApp()

Hi, welcome to the community!

It does work for me when I run your code; when I move the camera far from the panda, the sound gets softer, and when I move to the right of the panda, I hear the clicking coming from the left.

Which version of Panda3D are you using? On which operating system?

I’m running a windows10Ver1809 (64-bit)
I installed the module by using pip. pip install panda3d.
COuld you please let me know how did you move the camera? Simply by calling the camera.setPos(x, y, z) function? I might be moving camera in a wrong way because i’m actually blind and my goal is to develop audio games by getting help from panda3d’s cool features and sound system. This is my first time working with cameras in a game scene.

Ah! OK, I had moved the camera by clicking and dragging with the mouse, because by default, Panda activates mouse-based camera controls. The default camera controls override any position you set on the camera via code.

To deactivate the default mouse controls, add this to your code:


This should make changing the camera position work as intended.

1 Like

thank You, That did solve my problem