A question concerning preloading sample data and compressed/uncompressed/stream options

Hello, I’d like to understand what the “encoding - PCM” does with a “compressed” setting in the asset setting of a file. I don’t really understand why there’s two options - advanced loading mode and encoding format.
I would have thought that if the loading mode is “uncompressed” that determines your encoding format to tbe PCM? And the opposite - if you choose your encoding format to be PCM, then it follows that your loading format will be uncompressed. So I don’t really understand the difference and why both of these options exist, and what happens if they “conflict” (i.e. I use a loading setting of uncompressed with encoding vorbis - will it actually uncompressed? With some testing it seems so, but I’d like to see the logic behind what really happens).

Second, I would like to understand how preloading the data samples effects things. I can imagine that with compressed/uncompressed, it really just means that the data will get loaded to RAM right after a bank loads. But what happens with the streaming option? I mean with a streaming option, by definition of streaming, chunks of the asset are loaded, so what does preloading change? Does it make sure that some sort of “first” chunk of the asset is loaded right after the bank is loaded?

The compression setting determines how the audio is written to the .bank file, choosing Vorbis will compress the audio and store it in the bank, choosing PCM will store the audio uncompressed as PCM16 in the bank.

The loading mode determines what FMOD does at runtime with that bank, so if you compressed as Vorbis and used the compressed loading mode, FMOD will load that Vorbis audio into memory in its compressed form, decoding as it plays. For Vorbis with loading mode set to uncompressed, when FMOD loads that bank it will decompress the Vorbis to PCM up front.

When the “compression” format is PCM, choosing compressed or uncompressed as the loading mode makes no difference since the audio is already uncompressed. However streaming (like with all formats) will apply, reading chunks of audio from the bank as it plays and decompressing if required by the format.

When loading sample data you are apply that loading mode, either copying the compressed audio into memory, or decompressing it right then. Preloading doesn’t apply to streams, they always read from the bank as needed.

1 Like

Thank you very much!