So, what is the issue? Unless I'm mistaken, you want the volume of audio to be proportional to the distance from the audio source.
Couldn't you just use the distance formula?

As for using the distance to change the volume, just choose a maximum distance, say 100. Any further than that and the volume is 0. So, you divide the distance by 100, and that gives you a percentage which you can use as the volume.
So, if the distance is 50, then the math would give you .5, which would be what you need. Is that right?