# Is there any simple algorithm to convert a sound source in 3d to volume and panning

I'm looking for a simple algorithm which calculates an approximation of volume and pan at the position of the camera from the following 3d data:

• Camera (position and look direction)
• An item which emits mono-audio at a specific position.

Just a basic approximation is enough for this case.

• Updated the question – Viktor Sehr Jan 10 at 14:55
• Yes, volume in left and right channel – Viktor Sehr Jan 10 at 16:14

• appears that you got the idea. let's assume that the vertical plane is at $\phi=0$ (we call $\phi$ the azimuth angle) and that the gain when the emitter is at distance $r_0$ is $G_0$. so the inverse "square" gain is $$G(r)= G_0\frac{r_0}{r}$$ assuming that the maximum left-right swing is $\pm 45^o$, then the Blumlein gain is $$R(\phi)=\sin(45^o+\phi)$$ and $$L(\phi)=\cos(45^o+\phi)$$ – robert bristow-johnson Jan 11 at 17:01