Defined in carb/audio/AudioUtils.h

inline SoundData *carb::audio::convertToVorbis(const IAudioUtils *iface, SoundData *snd, float quality = 0.9f, bool nativeChannelOrder = false)

Convert a sound to Vorbis.

This may be within the range of -0.1 to 1.0. Vorbis is a lossy codec with variable bitrate, so this doesn’t correlate to an exact bitrate for the output audio. A lower quality increases encode time and decreases decode time. 0.8-0.9 is suitable for cases where near-perfect reproduction of the original audio is desired, such as music that will be listened to on its own. Lower quality values for the audio should be acceptable for most use cases, but the quality value at which artifacts become obvious will depend on the content of the audio, the use case and the quality of the speakers used. With very low quality settings, such as -0.1, audio artifacts will be fairly obvious in music, but for simpler audio, such as voice recordings, the quality loss may not be as noticeable (especially in scenes with background noise). This is 0.9 by default.

Otherwise WAVE channel order will be expected. All codecs use WAVE channel order by default, so this should be set to false in most cases. This is false by default.

  • iface[in] The IAudioData interface to use.

  • snd[in] The sound to convert to a new format. This may not be nullptr.

  • quality[in] The encoding quality of the compressed audio.

  • nativeChannelOrder[in] If this is true, the encoder will expect its input to be in Vorbis channel order.


The new sound data created. snd and the returned value must both be released after this call once the caller is finished with them.


nullptr if the operation failed.