Audio Optimization Discussion

The new Audio API is out. Lots of options and new way to do everything.

I want to open this thread about Audio Optimization.

One question that I have.

If you are to load all your sound effects in a loading session. Aren’t you better off then to store them as compressed AAC to save room?
Or is there any reason to still save them as .aiff files?
[import]uid: 8192 topic_id: 4300 reply_id: 304300[/import]

So, there are a few considerations:

First, .aiff is not a good format to use at all. Use .wav instead. More explicitly, you want linear PCM 16-bit signed little endian. AIFF is usually big-endian.

Second, AAC will save disk space. However, it does not save RAM. All formats are decoded to linear PCM when loaded. So in RAM, the AAC will be no different than the linear PCM .wav.

We also have some notes in the documentation that ‘perfectly looping sounds’ may be hard to achieve with ‘lossy’ compression formats like AAC, so be careful here.

I haven’t benchmarked whether AAC or WAV is faster to load into memory. You might give it a try and let us know of your results. Potentially, AAC might be able to use a hardware decoder. WAV on the other hand is dead-easy to load to begin with so I don’t know which has an advantage.

[import]uid: 7563 topic_id: 4300 reply_id: 13406[/import]

@ewing. Thanks for the great info. So let me make sure I understand.

If I am loading my sounds ahead then I should use them as aac since this saves room and since they are loaded, there will be no performance hit except while loading. [import]uid: 8192 topic_id: 4300 reply_id: 13427[/import]

Yes, the performance hit is during loading.

AAC takes up less disk space, but not less RAM.

[import]uid: 7563 topic_id: 4300 reply_id: 13468[/import]

@ewing. Thanks for the advice. It does seem that AAC cuts a bit out of the front and back of each sound. It’s tricky and maybe not worth to use for sounds under 1s.

[import]uid: 8192 topic_id: 4300 reply_id: 13512[/import]