The sounds in my game are at all different sample rates/formats (22K,44K,96K,wav,ogg,etc) depending on the source they came from. When I build the bank files for the Desktop, they all get converted to .ogg files, but do they also get converted to the best sample rate for the Desktop or are they left at the original sample rate? I’d rather the sounds don’t go through a sample rate conversion at run-time, this will be especially true for mobile. My assumption has always been that they get converted to the best rate/format for the platform.
- You must login to post comments
The answer to this question is somewhat complex, so I’ll break it down into parts.
Ogg versus Vorbis
It’s a common misconception that building with Vorbis encoding convert your audio files into .ogg files.
First, building your project creates a small number of “.bank” files. Each .bank file contains sample data taken from a whole collection of different source audio files, packaged into a single file for ease of in-game loading and organisation.
Second, Ogg is a common container format for Vorbis-encoded content, but is designed for loose files that are accessed separately and not for banks of mixed sample data. FMOD Studio therefore uses its own container format when building banks with vorbis-encoded content, not Ogg.
Encoding Settings are Platform-specific
In FMOD Studio, encoding format is specified on a per-platform basis. This means that you can specify different encoding formats, qualities, and sample rates for different platforms.
You can change the default encoding setting of a platform in the “Build” tab of the “Preferences” dialog by selecting the platform whose default encoding setting you want to change from the list of project platforms, then changing its “default encoding setting” properties.
You can also set the encoding settings for individual files, and for folders of files, by selecting a file or folder in the assets browser and clicking on the blue text that appears at the bottom of the browser. These settings, if specified for a file or folder, override the platform default for that file or folder. These encoding settings are also platform specific; when you set the encoding format for a files or folder in the assets browser, you are actually only setting its encoding format on the current platform. You can change the current platform by using the “Platform” drop-down menu located in the bottom-right corner of any FMOD Studio window.
FMOD Studio Does Not Pick the “Best” Sample Rate For You
FMOD Studio does not pick the encoding format, sample rate, or quality for you; it uses the settings you have specified in the assets browser and the “Build” tab of the “preferences” dialog, as described above.
That being said, when you add a new platform to your project’s platforms list, FMOD Studio does set that platform’s default encoding settings to the values we recommend. You’re free to change them after that, though.
The Relationship Between “Sample Rate” and “Quality”
The Vorbis encoding format does not allow you to specify a sample rate directly. Instead, you specify a “quality,” which is used to generate a variable bitrate. It is therefore impossible to guarantee a particular sample rate when encoding in Vorbis format. (For more information about the Vorbis format, see the Vorbis specification: https://xiph.org/vorbis/doc/Vorbis_I_spec.html)
If you do want to specify a particular sample rate for your sample data, we recommend using a format other than Vorbis. As specified in our manual here (https://www.fmod.com/resources/documentation-studio?page=getting-events-into-your-game.html#compression-formats-and-platform-settings), we recommend FADPCM format for mobile platforms.
Thanks. The reason I ask this is that I read somewhere in the docs (I can’t find it now) that on Desktop platforms sounds should use 48K so they don’t invoke resampling at runtime. If I include a source file .wav that is a 96K sample rate, will FMOD will convert it to Vorbis (on Desktop) and the sample rate (if left to the default) will be optimized for performance? I am more concerned with performance than I am memory.
Studio will compress Vorbis at 24KHz for mobile and 48KHz for everything else. If you avoid using pitch automation, modulation and doppler you will avoid the runtime resampler using default settings (the runtime rate is configurable via System::setSoftwareFormat).
If performance is a concern I’d recommend using FADPCM for low powered devices such as mobile.
- You must login to post comments
Please login first to submit.