3D Audio bug fix

I don’t know if anyone else has noticed problems with 3D audio in Panda3D, but I have a third-person shooter where the main character has sounds attached to him, and whenever I panned the camera, it was like the sound was coming from a different direction. It’s hard to notice unless you have headphones.

I found the problem in direct.showbase.Audio3DManager.py. It’s an easy fix. Just replace lines 268-269 with the following:

forward = self.root.getRelativeVector(self.listener_target, VBase3(0,1,0))
up = self.root.getRelativeVector(self.listener_target, VBase3(0,0,1))

If anyone can repro this bug, please confirm it on the bug report.

Thanks!

How do you repro the bug? Do you just listen and get a feel for how it sounds? Should the vectors be -v or +v? Could openAl and fmod treat them differently?

Sorry, I should have posted a sample.

Here’s a zip file. Try running “buggy-audio.py” with headphones on. The sound is coming from the box, and when you rotate the camera around the box, it sounds like it’s coming from different directions, when really, the box is still right in front of the camera. Then try “working-audio.py” and see the difference.

“working-audio.py” uses my patched version of Audio3DManager, found in “PatchedAudio3DManager.py”.

Sorry about that, I should have posted this first. :blush:

Did this ever get fixed? I’m experiencing the same problem where depending on the view direction of the camera, sounds are be being emitted from the wrong directions (i.e. sound source to the left of camera’s forward direction, but sound comes out of right speaker)

Bumpity bump. I don’t mean to be a pain, but I’d like to see if this fix can get added. I can alter the file on my own machine, but that doesn’t fix it for people playing using a p3d.

The bug occurs if the camera is facing either the +x direction or -x direction (i.e. if it’s parallel to the x-axis). In this case, the left and right sounds are reversed.

I had the same problem. I just took the original 3d audio manager code and made my own version of it, which I needed to do anyways to add some game-specific features.

And if I were doing an offline game and could package the patched file with it that would be fine, but I’m distributing and an embedding a p3d for other people to play, and the problem exists in the runtime environment.

Well Audio3DManager is just python code, so you could create your own verison of it alongside the Python code for your app and for example, from my_custom_audio3dmanager import Audio3DManager, instead of the regular import.
Of course I agree that it is a bug and should be fixed, but unless another official release comes before you need to release your app you would need to do something like that.

That awkward moment when you’re completely oblivious to something. I don’t know why that didn’t even come to mind. I was only considering patching the file in my SDK directory and not importing my own patched file.

Thanks.

User-submitted patches for bugs are welcome. :slight_smile:

David

For the record, the patch from et1337 has been in CVS for a while now and will be included in the upcoming 1.8.1 release.

Since I’m quite new around here, I don’t know how often official releases happen. What’s the time frame, more or less, for 1.8.1? If we’re talking about a few months then I don’t patch, I just wait. If years, then I might hack a bit :slight_smile:.

usually panda releases are done when they are done. please note that we have buildbots that create a new panda package every day. you can find it in the download section, “devel” release.