Lesson 3

Table of Contents

Decoding Compressed Data

Optimizations are most often applied in the later stages of a game production, but it is nevertheless important as a game with a stuttering framerate can make quite a difference to the overall experience. Any game will have numerous processing tasks running during gameplay, and, likewise, the decompression of Vorbis encoded media will be added as a task on that list. To reduce the processing used on decompressing Vorbis encoded media, you can use the Decode compressed data feature offered in the AkBank component.

This will decode all Vorbis encoded media upon loading the SoundBanks, so no additional resources will be needed the next time the same Events will be posted by the game. Compared to not having this option selected, this option will increase the size of the SoundBank in memory, resulting in the equivalent size to using PCM encoding in the first place. Then why not just encode the PCM to begin with? For example with downloadable games, you might want to keep a low SoundBank size for distribution, and then let the SoundBanks be decoded once the game loads. An estimate of the SoundBank's decoded size, can be found in the SoundBank Manager after conversion.

The Dungeon SoundBank is the Region SoundBank with the most proportional change in data size after decompression, and so you will set this SoundBank to decompress and monitor the difference. In the following steps, you will start by monitoring the data size in memory before decompression, then enable the Decode compressed data option and then monitor the change in data size.

  1. In the Unity menu, go to Audiokinetic > Certification > 301 > Lesson 3 and select Decompressing SoundBanks.

    Before setting the SoundBank to decode the compressed data, let's profile the current memory usage.

  2. In Wwise, click Remote…

  3. In the Remote Connections window, highlight Wwise Adventure Game (Editor) and click Connect.

  4. In Unity, click Play.

    Once the game has initialized you can exit Play mode again.

  5. Press ESC to open the WAG menu and click Play again to exit Play mode.

  6. In the Wwise menu, click Layouts and select Profiler.

  7. In the Advanced Profiler, select the Memory tab.

  8. In the Performance Monitor, drag the Time Cursor backwards a few seconds.

    Notice that the Dungeon SoundBank's Peak Used is using approximately 2.4 MB of memory.

    Next, let's decode the SoundBank when loaded. The Dungeon SoundBank can be found on the Wwise game object in the L3_2 - Dungeon Audio Environment Scene.

  9. In Unity's Hierarchy, go to the L3_2 - Dungeon Audio Environment Scene and select the Wwise game object.

  10. In the Inspector's AkBank component, select Decode compressed data.

    A warning window will appear.

  11. Click OK to dismiss the dialog.

    The Decode compressed data option will now be enabled. Below it you will see a 'Save decoded bank' parameter, which should stay disabled.

    When decoding a SoundBank, the decoded data will be moved into the Prepare Pool. The property for setting the size of the Prepare pool is found in the AkInitializer components Initialization Settings, also refered to as 'AkWwiseInitalizationSettings'.


    The AkWwiseInitalizationSettings Asset file is used to allocate memory pools for game initialization management like keeping track of game syncs, sound positions, decompression, and so on. Learn more about setting memory pools in Lesson 9, or the section titled 'Managing Reserved Memory' from the Wwise-251 Certification.

    This pool defines the amount of reserved memory Wwise will use for the prepared or decoded SoundBanks. Let's now adjust the Prepare Pool to the size of the decoded General SoundBank.


    The Decode compressed data option will only be able to decode the Audio Sources in the SoundBank that are set to Vorbis. The option has no effect on SoundBanks without any Vorbis encoded media.

  12. In the Hierarchy, select the WwiseInitializer game object.

  13. In the Inspector, double-click the AkWwiseInitalizationSettings Asset file.

    When the Dungeon SoundBank is decoded, it will be transferred into the Prepare Pool, so you will have to set the Prepare Pool to the decoded size of the Dungeon SoundBank. You can find this information in Wwise's SoundBank Manager view.

    The Decoded Size of the Dungeon SoundBank is 9,159,252 bytes (9.2 MB). Let's set the size to 10 MB (10,000,000 bytes).

  14. Set the Prepare Pool Size property to 10000000.

    When setting memory pools, you might have to apply the changes by entering and exiting Play mode.

  15. Click Play.

  16. Press ESC to open the WAG menu and click Play again to exit Play mode.

    You have now ensured that the memory pool values are applied, and can enter Play mode while connecting the Profiler.

  17. Click Play.

  18. In Wwise, click Reconnect.

    Look in the Advanced Profiler's Memory tab and notice that there is no longer a Dungeon SoundBank in the Pool Name column.

    This is because it has been transferred into the PreparePool. By looking at the Peak Used column for PreparePool you will see that the allocated runtime memory is only 8.4 MB. As such, let's head back to Unity and readjust the Prepare Pool size to what is needed, along with a little headroom.

  19. Press ESC to open the WAG menu and click Play again to exit Play mode.

    Let's set the Prepare Pool Size to 9 MB, so you only reserve the utmost necessary amount of memory for the PreparePool memory pool.

  20. In the Unity Inspector, go to the AkWwiseInitalizationSettings and set the Prepare Pool Size to 9000000.

When using the Decode compressed data option, you will have a higher memory usage, but you will avoid using CPU resources on decoding the Vorbis encoded media during gameplay, ensuring a smoother game experience.