User Tools

Site Tools


Sound Spatialization

Spatialized Sound is the effect of sounds being separated or directional. Sounds can appear to sound from the left or right, or quieter depending on how far it is from a position.

This is a super short tutorial with the very basics on how to get it going. Either mono or stereo samples can be used.

Start by configuring a SoundSystem:

Listeners = 1

Having a listener turns on spatialization.

Then on your sound, specify a minimum distance with DistanceList:

SoundList    = @
Sound        = motor.ogg
Loop 		 = true
Pitch 		 = 1.0
Volume 		 = 0.4
DistanceList = 0

If you attach this sound to an object and move it around the screen you will notice the sound shift from left to right. This sound positioning is based around the centre of the screen, assuming your camera is at position (0, 0). Or to put it another way, the centre of the screen is where the “listener” is listening.

In the case where you want to base the listener somewhere else, for example, if the camera follows your hero, then you might place the listener in the same location as the camera with orxSoundSystem_SetListenerPosition.

So on every update:

orxSoundSystem_SetListenerPosition(0, &myCameraPositionVector);

In the above example, the 0 is the listener number, so the first listener, and the current position of the camera or some other object.

en/tutorials/audio/sound_spatialization.txt · Last modified: 2023/07/07 17:36 (8 months ago) by iarwain