mbillingr/ambisonic

explain relationship to `rodio::source::Spatial`

khimaros opened this issue · 1 comments

maybe ambisonic predates this functionality in rodio?

https://docs.rs/rodio/latest/rodio/source/struct.Spatial.html

Hi, thanks for your interest in ambisonic.

Rodio's Spatial source has been around longer than ambisonic by about a year. Actually it is the reason that ambisonic exists - I was frustrated with the limitations imposed by Spatial :)

The documentation does not say so, but by looking at rodio's sources one can tell that it tries to compute the loudness of the left and right channel by the relative distance of the sound source to each ear. This seems right on the first impression, but leads to the strange effect that the further away a sound is the more it is played on both ears. E.g. a sound near the left ear will be played only on the left channel, but the further it moves to the left, the more it will appear on the right channel too (although getting quieter in total). It is quite possible to fine-tune the setup so it sounds right in a mostly static scene. If you try to use this model in a dynamic scene with sound sources and the listener moving around freely it's impossible to make it sound right.

In contrast, ambisonic uses a directional model of sound. A sound coming from a particular direction will always be heard from that direction while fading with increasing distance. This is very close to how we hear in the real world. In principle it also supports surround sound with arbitrary channel configurations but that requires some tinkering. It is even possible to plug in custom head-related transfer functions and get ultra realistic 3D sound with headphones but that is super-advanced and highly experimental.

Also, ambisonic can simulate doppler effects when sounds move.

If you have further questions, I'm here to answer :)