Skip to main content
xWMA is a subset of the Windows Media Audio (WMA) Professional compression format. xWMA decoding is supported by XAudio2 in software. xWMA uses the WMA bit-stream format in a lightweight wrapper and is useful for dialog and music where a small usage of the CPU can be afforded as a cost of achieving greater compression. A quality setting allows the user to vary the bit rate of the compressed sound.
Both xWMA and XMA2 have their origins in the codecs developed for Windows Media Audio (WMA) and both have been developed specifically for XBOX games. The subset of the available codecs and parameters used by XMA2 is smaller than the subset used by xWMA. While both xWMA and XMA2 were developed for XBOX, they’re not interchangeable: the headers for each file format differ, and the formats are incompatible with PC versions of Windows. The codecs used for XMA2 and xWMA are slightly different, too, so each will have its own artifacts from the compression system that’s used.
In this topic:

xWMA encoding

To encode audio data to xWMA, use the xWMAEncode command-line tool or a custom tool that relies on XWMAEncoder.lib.

xWMAEncode

To encode audio files as xWMA for use with XAudio2, use the xWMA command-line encoder.

XWMAEncoder.lib

XWMAEncoder.lib is a statically linked library that’s available as an alternative to the xWMA command-line encoder command-line tool. Your custom tools rely on this library to perform xWMA encoding by using the XWMAEncoder function. For details and examples of using this function, see the XBOX 360 documentation.

xWMA decoding

Software decoding of xWMA is supported on Windows and on XBOX One in XAudio2, as well as through the xWMADecode API.

xWMA looping

xWMA doesn’t support loop regions or looping of arbitrary packets within an xWMA file. Only an entire xWMA file can be looped. In XAudio2, xWMA has restrictions related to looping for the values in the XAUDIO2_BUFFER that’s passed to IXAudio2SourceVoice::SubmitSourceBuffer. If all the xWMA file’s audio data is submitted as one buffer, and if the user wants to loop it, the following restrictions must be met.
  1. XAUDIO2_BUFFER.LoopBegin must always be zero.
  2. XAUDIO2_BUFFER.LoopLength must be zero or the size, in samples, of the entire file’s xWMA data.
  3. XAUDIO2_BUFFER.LoopCount can have any value.
  4. XAUDIO2_BUFFER.Flags must be set to XAUDIO2_END_OF_STREAM.
If xWMA audio data is submitted as more than one buffer, the audio can be looped only manually by resubmitting the series of buffers. Because a period of silence might be introduced while xWMA audio is looped, looping of xWMA audio should generally be used only with sounds that have smooth fade-ins and fade-outs. Examples include the sounds of ocean waves and certain kinds of subtle ambient noise.

Structure of an xWMA file

An xWMA file is a standard RIFF file with the following types of chunks. | Chunk FCC| Description| | --- | --- | --- | --- | | RIFF| The standard RIFF chunk contains the following:
1. In the first four bytes of its data section, contains a file type with the value XWMA.
2. In the remainder of the data section, contains the other chunks in the file. | | fmt| This chunk contains the format header for the xWMA file. The data in this chunk corresponds to a WAVEFORMATEX structure for xWMA data with one or two channels, or to a WAVEFORMATEXTENSIBLE structure for xWMA data with three or more channels. | | data| This chunk contains the encoded xWMA audio data. When xWMA is used in XAudio2, the contents of the data chunk will be read into a buffer and passed to a source voice as the pAudioData member of an XAUDIO2_BUFFER structure. The contents of the data chunk don’t need to be byte-swapped. | | dpds| This chunk contains the decoded packet cumulative data size array where each element is the number of bytes accumulated after the corresponding xWMA packet is decoded in order. The size of this chunk, measured in UINT32, and the contents of its data section are used in XAudio2 to fill out an XAUDIO2_BUFFER_WMA structure. |

See also

xWMA command-line encoder
Last modified on August 20, 2026