If we represent each sound as a point sound with the following
characteristics we could handle echos, phase shift, blocking,
and the like.
Represent the point sound with
Power (in db)
Location
Equation describing -3db surface (the surface on which the
signal is half as loud (or -3db) as at the source)
If this is done, a direction vector can be traced from the listener to
the point, and it's intersection can be found with the -3db surface.
In rectangular coords, this is a bear, but in spherical coords
it's easy. The -3db surface can be best described as a function of
R, theta, and phi. To trace the listener back to the source, just look
at the listeners theta and phi from the source's internal reference.
Now, if no blocking is involved (i.e. we're not at the backside of the
radio) then the sound we hear is based off of 1/R^2 and the source power;
however, if blocking is involved, then the our distance R must be scaled
accordingly. Take the -3db surface at that vector and divide our distance
R by it and then apply the inverse square law. The R of the surface could
be normalized such that with no blocking, the value of the scaling factor
would be 1 and at a blocked point, the value would be less. Call this
scaling factor K. So now the sound level depends on 1/(R/K)^2.
To handle phase shift, assume we have two ears separated at a distance H.
The vector to one ear must be different than to the other. Take the
distance to one and the other and from that the two sound levels can be
found. However, the phase shift is due to the propigation velocity of the
sound, so the time required to get two one ear will be slighty more or less
to get to the other. This time delay can be represented as a phase shift in
phasor notation, but could be left as a delay.
To handle echo, etc. imagine the other objects near the node as providing
feedback into the sound. Just consider the other objects as negative or
positive sources of the orignal sound (with power loss and phase shift as
determined by distance) and then scale the signal according to object
material (sound soak or slate rock) to determine how it reflects the sound.
Treat it from then on out as just another point source, and mix the two
together.
For sound coming from a room into a hallway, they doorway can be the source
until we get have a line of sight into the room. Its -3db surface would
have the right shape to compensate.
For background noise, consider the concept used for the surround channels
in theatres and musak tracks in stores - A significant number of
insignificant sources. One could have 1 source at 85db or 4 at 79db spread
apart. Or even take 8 at 76 db. As more sources are added and spread apart
the overall power remains the same (1/2 power = -3db), but the source is
spread out and made more like a just ambiant noise. The noise of the city
is just that, a significant number of insignificant sources.
Most of this stuff is browser dependant; however, if each sound is
represented with all the other considerations that are non physical (such
as radiusOfEffect which we can set if we to stick a jet engine in a room
but only have the people close enough to hear it instead of the neighbors)
as well as power and the spherical equation of the -3db plot (very few
bytes - for a sphere, it's f(R,theta,phi) = 1 for the unit circle) then we
will allow browsers that can handle mixing lots of sounds together to create
a very realistic sound field.
To add another level of complexity would be do represent the acoustic
properties of objects as a function of frequency so that cities will have
dull roars (low) and china shops will have lots of highs.
I'll actually provide equations if this sort if thing look interesting to
anyone.
-David Jedynak
([email protected])