# Eqation between sound intensity and distance

For a project I'm trying to build a sound engine as realistic as possible and I am trying to add more features to enhance the sound localization. So far I've only implemented one of the three main methods to localize sound: time delay. Another main sound localization method is difference in volume. This however, looks easier than it is. I know very little about sound and the ways to measure intensity and power, so please correct me if I confuse terms and concepts.

In the sound library I'm using I can set the volume of a sound sample between 0 and 100, just like on a volume mixer. This means that when I set it to 50, the sounds played sound half as loud as when it is turned up to 100. I know the intensity of sound can be calculated using this equation:

$$I = \frac{P}{4\pi r^2}$$

But when I select a distance for the virtual source and I want to know at what 'volume' the sound should be played, I decided the power (P) and $4\pi$ were constants so I could leave them out:

$$I \sim \frac{1}{r^2}$$

But this is where I didn't really come any further. I don't know if I should use some reference point that somehow defines the volume should be 100 if it is at distance zero:

$$Volume = \frac{100}{(r+1)^2}$$

Is this the correct way to calculate at what volume the sound should be played (with the distance in meters)?

• The usual way to measure "volume" or "loudness" is the decibel. – ACuriousMind Apr 11 '15 at 23:28

well, that's good but not perfect. because in this model you can not have volume 0 unless you infinitely far from the source.

the volume zero for us human should be when we can not hear any more sound. In physics it is called "threshold of hearing". so we want our function Volume to be some how that when we get pass the threshold of hearing, the volume would be zero.

in order for us to hear the $I$ should be around $10^{-12}$. so we calculate the radius that the sound will fade away after that:

$$10^{-12}=\frac{p}{4\pi r^2}$$

$$4\pi r^2 . 10^{-12} =p$$

$$r^2=\frac{p.10^{-12}}{4\pi}$$

So I define my Volume object this way:

$$Volume=\frac{(\frac{10^{-12}}{4\pi}-r^2)}{\frac{10^{-12}}{4\pi}} . 100$$

$$Volume=\frac{10^{12}p-4\pi r^2}{10^{12}p}$$

$$Volume = (1-\frac{4\pi r^2}{10^{12}p}).100$$

so we have:

$$Voulme=100-\frac{4\pi r^2}{10^{10} p}$$

with the domain of: $r \leq 5.10^5\sqrt\frac{p}{\pi}$

and that could be a good volume function. take care ;)

• In your fifth equation you 'add' p after multiplying by 4*pi*r^2. Was this intentional and if so, what value should be chosen? – kdnooij Apr 12 '15 at 7:26
• @kdnooij no it was a mistake in typing. I forgot to put the p. if you simplify the first volume function you will get to the last one. – Mobin Apr 12 '15 at 7:52
• @kdnooij notice that when you put r=0 , you'll get volume 100, and as the r get higher it will decrease until it gets to the "threshold of hearing", which is $5.10^5 \sqrt{\frac{p}{\pi}}$ . if you put that amount you will get zero volume. – Mobin Apr 12 '15 at 8:02
• Hmm but shouldn't the volume decrease with the distance squared? Because that's not what happens in this model. – kdnooij Apr 12 '15 at 19:57
• @kdnooij what? yes it is. r=0, volume is 100 , and as the r is getting higher the volume is getting lowered in squared. until it gets to a level that the sound can not be heared by human ear. just try some numbers, you'll see that it is decreasing. – Mobin Apr 12 '15 at 20:35

I know very little about sound and the ways to measure intensity and power, so please correct me if I confuse terms and concepts.

You probably do not want to use intensity and power at all. Intensity is the product of particle velocity and sound pressure. To me it seems that pressure is the quantity you should use. Sound power is as power as any power in physics, it is the rate at which work is done. You probably do not want that either.

Is this the correct way to calculate at what volume the sound should be played (with the distance in meters)?

You should decide which source and field model you want to use before you can answer that question. For example, the sound pressure of a point source in a free field is inversely proportional to the distance from the source.