The ADPCM compression preset is a lossy compression, which means that some data is altered and lost during compression, that can be applied to waves in wave banks to achieve compression ratios of up to 4:1. The compression sample block size is variable to allow a desirable tradeoff between size, quality, and resolution (for placing loop points).
ADPCM compression works by separating the waveform into "blocks" and predicting the variation of the waveform samples within each block. The size of the blocks is measured in samples, and can be modified by editing this parameter in Compression Presets. The smallest block size is 32 samples, the highest is 512 samples.
Larger "blocks" will allow better compression, resulting in smaller file sizes, but at the expense of sound quality and resolution for aligning loop points.
In general, you will get the following tradeoffs as you modify the SamplesPerBlock value:
If SamplesPerBlock... | File Compression | Sound Quality | Loop Point Resolution |
---|---|---|---|
Increases (up to max 512) | Increases | Decreases | Decreases |
Decreases (down to min 32) | Decreases | Increases | Increases |
Because ADPCM uses sample "blocks" that are aligned one after the other, a wave compressed with ADPCM may have an unfinished, "partial" block at its end. The ADPCM decoder generates silence for the remainder of this partial block which will cause the wave to not loop seamlessly.
To properly loop waves using ADPCM compression in XACT, the wave length and any loop points in the wave data must be aligned to the sample block size. Many wave authoring packages allow you to sample block align wave lengths and loop points.
Depending on the value of the SamplesPerBlock parameter of the compression preset you are using, you may have more or less resolution with which to align the end of the wave data and/or loop points.
If you attempt to apply compression to a non-aligned wave, you will either get an error or a warning, depending on whether the wave is being used in any looping Play events. You may not compress a wave used in any looping Play events. Remove it from the looping Play events and re-apply compression.
If you apply ADPCM compression to a properly aligned wave, then re-author the wave so that it becomes non-aligned, XACT will remove the ADPCM compression from the wave without warning. Additionally, if you re-author a wave file to be properly block-aligned and reload the XACT project that contains the wave file, you may get a warning that ADPCM compression will still not properly apply. Rescan the wave in the wave bank to restore proper functionality.
If the wave is to be used exclusively in non-looping mode, this restriction does not apply. If changes are made in the XACT tool that make the wave part of a looping Play event, a warning will appear and the loop will not be allowed until the compression is removed from that wave, or the wave is re-authored to be sample block aligned.