1
\$\begingroup\$

I am working on a very basic first person project. Given a sound source's X Y Z coordinates and the camera's X Y Z as well as the angle the camera is facing, I would like to know how these values can be used to adjust the gain of the left and right channels of a sound source as it plays a sound. I have been told this can be done with a primitive technique used in early 3D games from the 90's (which is what I'm aiming for) called binaural panning.

I am struggling to find written tutorials on how this can be achieved so I have been referring to chat gpt but have been getting very inconsistent solutions.

What has been consistent is that it says I would need to find the distance between the sound and the listener which makes sense

Then to use dot product to calculate angle of incidence, which when I tell it to clarify it starts giving inaccurate solutions.

And panning coefficients, which is where I can't find any documentation on whatsoever and am curious if GPT just made that term up.

Would anyone know the most effective way to achieve spatial sound given X Y Z and angle of incidence?

\$\endgroup\$
3
  • \$\begingroup\$ Advice n.1 - start from 2D. Get a piece of paper and draw your ears (2pcs) and point sound sources around them. Now it's geometry time, should be quite intuitive from now on. \$\endgroup\$
    – Kromster
    Mar 26 at 9:06
  • \$\begingroup\$ For this project, do you already have a game engine in mind? Because if you already have it, it might help to let you know which one. Does the 3d spatial sound of game engines no longer give you the desired result? Do you intend to do something more thorough? \$\endgroup\$ Mar 27 at 15:08
  • \$\begingroup\$ I am actually using a 2D game engine, Construct 2, but am developing a pseudo 3D game. Construct 2 doesn’t have spatial sound implemented the way I need. So I will have to implement my own. \$\endgroup\$
    – Jubel
    Mar 28 at 18:17

0

You must log in to answer this question.

Browse other questions tagged .