Sounds Overview

The XNA Framework provides audio playback through several core audio classes. It also provides audio classes to developers that use Microsoft Cross-Platform Audio Creation Tool (XACT) to manage multiple sounds.


If your game is to use a few sound files, then the SoundEffect, SoundEffectInstance, and DynamicSoundEffectInstance classes will provide everything you need to play and stream audio during gameplay. For developers that plan on working with multiple sets of sound files during the gameplay, XNA Game Studio provides XACT, an advanced audio content creation and management tool. XACT provides audio designers with the ability to load sound files into groups, to organize those files into discrete cues that can be activated by in-game events, and to create sound transitions. Those using XACT have additional classes that specifically use XACT project data to load and play sounds. For more information about XACT, see Getting Started with XACT.


XACT is not supported on Windows Phone.

Simple Audio Playback

The simplest way to play sounds for background music or sound effects is to use SoundEffect and SoundEffectInstance. Source audio files are added like any other game asset to the project. For example code, see Playing a Sound, Looping a Sound, and Adjusting Pitch and Volume. For background music, see Playing a Song.

SoundEffect and SoundEffectInstance are available on Windows, Xbox 360, and Windows Phone.

Accessing the Audio Buffer

Developers can use DynamicSoundEffectInstance for direct access to an audio buffer. By accessing the audio buffer, developers can manipulate sound, break up large sound files into smaller data chunks, and stream sound. For example code, see Streaming Data from a WAV File.

3D Audio

Both the Cue (XACT) and SoundEffect classes provide the ability to place audio in a 3D space. By creating AudioEmitter and AudioListener objects, both sound playback APIs can position a sound in 3D, and can change the 3D position of a sound during playback. Once you create and initialize AudioEmitter and AudioListener, call Cue.Apply3D or SoundEffectInstance.Apply3D.

Audio Constraints

Each platform has limits on the number of sounds playing simultaneously. An InstancePlayLimitException exception is thrown if this limit is exceeded. The following table shows the maximum number of simultaneous playing sounds based on platform.

Platform Number of sounds that can play simultaneously
Windows Phone 64
Xbox 360 300
Windows No limit



Online Resources