[Bf-committers] Game Engine Audio status

Alexander Ewering blender at instinctive.de
Tue Dec 28 22:56:35 CET 2004


Short status overview:

(NOTE: As I don't know how much of the game engine sound worked BEFORE (and it
seems like nobody knows :) - some of this information may be redundant or not
too surprising :)

- WAV files of any format can be used (might try to extend this to mp3)

- Attenuation of sounds with distance. There's a new value "Dist:", which
   is the half-power distance (like with Quad lamps).

- "Volume:" is also used as an extra absolute scaling factor for volume

- 3D Panning of sounds depending on the position of the sound source relative
   to the listener is implemented. Works for both mono and stereo sources (though
   for stereo sources it's probably a bit stupid).

   The 'width' of the 3d panning (how far it pans when hard left/right of the
   listener) can be adjusted by the new per-sound "PanFac" parameter.

- "Pitch:" implemented. I don't think this was implemented before (looking at
   the code). So now, you can control a sound's / sound actuator's pitch in
   (fractions of) semitones.

- Sound culling. When a sound is so soft that it's below factor 4/128 of the total
   mix volume, it is removed from the mixing process, saving CPU cycles. It is
   resumed as soon as it returns in the range of the listener (above 4/128).
   Because of the inverse quadratic attenuation, a sound never is truly
   'unheard'.

- Overall latency is very low. I'm using a 512 samples buffer, which is in the
   range of 10 milliseconds, and about 30-50 times better/faster than with the former
   openal implementation. For being safe from dropouts, 2048 samples (about 40 ms)
   are still a bareable latency for untrained ears, and safer from dropouts.

There might still be 1 or 2 memory leaks I'll have to find - if any.

If there are any questions, feel free to post them...

I did this in instinctive-blender, but it's easy to port (i'll do it) should there
be interest to have it in the official tree...

For *me*, this means the *first time* i can use sound in the game engine :)

| alexander ewering              instinctive mediaworks
| ae[@]instinctive[.]de   http://www[.]instinctive[.]de


More information about the Bf-committers mailing list