6. The Direct-Sound Calculation Model
The calculation part of the project is intentionally simple. It does not try to model a complete room. It calculates the direct path between each source and the listener. This is important because it keeps the system testable and avoids making claims that are too large.
The model calculates three main things: distance, level and time of flight. First, it calculates the difference between source and listener position on the x, y and z axes. These differences are dx, dy and dz. From these values, it calculates the straight-line distance between source and listener. This distance is called r.
Second, the model calculates level attenuation. The system uses 1 metre as the reference distance. At 1 metre, the level change is 0 dB. As the source gets farther away, the level decreases according to free-field pressure attenuation. This follows the relationship p proportional to 1/r. In dB, every doubling of distance gives about minus 6.02 dB. So 1 metre is 0 dB, 2 metres is about minus 6 dB, 4 metres is about minus 12 dB, and so on.
This is sometimes easy to misunderstand. It is not minus 6 dB per metre. It is minus 6 dB per distance doubling. That is why a 20 metre test position gives about minus 26 dB, not minus 120 dB.
Third, the model calculates time of flight. Sound does not arrive instantly. If a source is farther away, the sound arrives later. The delay is calculated as distance divided by the speed of sound. For example, at 20 metres, the time of flight is about 58 milliseconds.
There is also a practical limitation: the 1 metre reference clamp. Below 1 metre, the system does not increase the level further. This prevents unrealistic gain close to an idealised point source. However, this also means that if the goal were to simulate a very small studio or very close source-listener distances, this part would need to be reconsidered.
The direction calculation is also part of the model. The source position is converted into azimuth and elevation. Listener yaw is not added to the source azimuth. Instead, source direction goes to the MultiEncoder, and head rotation goes separately to the SceneRotator. This separation prevents double rotation.
For me, this is the core of the project: a simple model that is honest about what it does.