I am trying to put 3Dish audio in a game I'm developing, and I'm unsure how to do positional sound. I want to be able to adjust the volume of the audio's channels depending on how far it is and the orientation.
Since you didn't mention any API for sound I'll give you the general answer.
First get the distance between the audio listener and the audio source
Then you define a distance where you don't want it to be audible anymore, lets say 150m
If your distance is 40 meters from the source, then the volume is about 73%.
To give you an equation that would be:
That's assuming you want the volume to change linearly with your position change.