Simulating a moving sound source perceived by a listener on a 2d plane.

cs5947 Member Posts: 28 Member

I want to simulate a basic moving sound source and a ‘microphone’ on a 2-dimensional Cartesian plane. The plane will range from, say, -10 to 10 on both axes, and the sound source/listener will both be somewhere along those lines.

Then I want to be able to calculate the perceived amplitude and Doppler effect when the sound source moves away from, or closer to the microphone, in both directions.

Doing the Doppler effect is a piece of cake, I use a delay line and change the time of the delay to change the wavelength of the sound.

The problem that I’ve run into is that I don’t know how to do the AM math. I’ve came up with this formula for amplitude modulation across a single direction

Amplitude = 1 / (Sound position - Ear position)

This works okay-ish with the case I’ve demonstrated but the closer it gets to the sound source, the higher risk it is at to explode. This is because the result of (Sound position - Ear position) gets closer to 0 the closer they are in values, and 1 div 0 is theoretically infinity, which is just interpreted as 0 by Reaktor.

When I try to do this along 2 axes, with both the sound emitter and the microphone having 2 values corresponding to the X and Y axes, it doesn’t work as intended.

I want to do the same thing that game engines like Unity do to manage sound AM, but across a 2-dimensional plane and in Reaktor.



Back To Top