Comment by nearbuy

16 days ago

Uncompressed audio is typically used for sound effects, while music is compressed. Latency is the primary benefit. Uncompressed audio will play immediately while an mp3 will have a few frames delay. Sounds like gunshots or footsteps are typically short files anyway, so the increased memory usage isn't that painful.

Games also can stack many sounds, so even if the decoding cost is negligible when playing a single sound, it'll be greater if you have 32 sounds playing at once.

> Uncompressed audio will play immediately while an mp3 will have a few frames delay.

I'm not sure what you mean by this. Encoding latency is only relevant when you're dealing with live audio streams - there's no delay inherent to playing back a recorded sound.

> Sounds like gunshots or footsteps are typically short files anyway, so the increased memory usage isn't that painful.

Not all sound effects are short (consider e.g. loops for ambient noise!), and the aggregate file size for uncompressed audio can be substantial across an entire game.

  • > there's no delay inherent to playing back a recorded sound.

    There absolutely is. You can decompress compressed audio files when loading so they play immediately, but if you want to keep your mp3 compressed, you get a delay. Games keep the sound effects in memory uncompressed.

    > Not all sound effects are short

    Long ambient background noises often aren't latency sensitive and can be streamed. For most games textures are the biggest usage of space and audio isn't that significant, but every game is different. I'm just telling you why we use uncompressed audio. If there is a particular game you know of that's wasting a lot of space on large audio files, you should notify the devs.

    There is a reason both Unity and Unreal use uncompressed audio or ADPCM for sound effects.

    • > but if you want to keep your mp3 compressed, you get a delay

      If that really bothers you then write your own on-disk compression format.

      > why we use uncompressed audio

      > ADPCM

      ... which is a compressed and lossy format.

      4 replies →