Skip to main content
The XMA2 command-line encoder tool (XMA2Encode) converts a set of Pulse Code Modulation (PCM) files to XMA2 format or an XMA2 file to PCM format. This tool can be used for both XBOX 360 and XBOX One. For XBOX 360, you can use the output of the tool without any changes. For XBOX One, the seek table might need to be byte swapped. The code to do this is in the XBOX One format section of this topic.

Using XMA2Encode

The following code and table describe how to use XMA2Encode.

Remarks

All options can be abbreviated to their first letters. The following table lists the error codes that XMA2Encode can print to indicate problems with encoding.

XBOX One format

The output of XMA2Encode must be ULONG byte-swapped for XBOX One. If the input is a .wav file, the output can be used without alteration. To byte-swap the seek table, use the following lines of code.
Consider adding the lines of code to your app to test the functionality, and then perhaps write a separate tool to perform the swap so that no preprocessing is required of your app.

Writing your own XMA encoder tool

It’s possible to write your own encoder tool by using the methods defined in xmaencoder.h and implemented in xmaencoder.lib. The xmaencoder.h file is located by default in the C:\Program Files (x86)\Microsoft GDK\191100\GXDK\toolKit\include folder. The xmaencoder.lib file is located by default in the C:\Program Files (x86)\Microsoft GDK\191100\GXDK\toolKit\lib\amd64 folder. The single method that’s available in the header and library is XAudio2XMAEncoder. Don’t use the XMA2InMemoryEncoder and XMAInMemoryEncoder methods (legacy) that are defined in the header.

In this section

XMA2 encoder reference Describes the functions that are available in xmaencoder.lib.

See also

XMA2 overview
Last modified on August 20, 2026