I am working on a project where I need to use a geomagnetic sensor data to drive a prerecorded sound such that the sound effect creates an auditory illusion that the source of the sound is always orginating from the geographic north. I have limited processing power at my disposal, an MSP432 microcontroller.
Do you have stereo output? If so, just manipulate the volumes in the left and right channel differently.
For example when:
- facing north: both channel levels at 100%
- facing east: left channel 60%, right channel 40%
- facing south: both 20%
- facing west: left channel 40%, right channel 60%
The user turns towards the loudest sound, and thereby should find north. I would avoid dropping levels below a certain threshold at all times. I'm sure you'll find an easy way to calculate the levels. Basically, on each hand side, there's one channel becoming quieter more quickly than the other channel until they both have their plateau in the south. Additionally, you can delay the channel's signal which is furthest away from north a little bit. E.g. when facing east the right channel's signal arrives a few milliseconds later than left (try above 50 ms or it is too hard to notice).
However, so far that's only good enough for orientation on a 2d plane. The user may not be on the surface but in a high-rise building or on a mountain. The height information makes the third dimension. One way is to reduce volume overall with height. But I think a better way is to change pitch. The closer to the ground the higher the frequency of the sound. But I don't know if this requires already too much processing by your chip.