Share via


How to: Add a Sound File to Your Game Using XACT

This example demonstrates how to add wave (.WAV) files into an XACT project that can be built and interpreted by an XNA Game Studio Express game to play audio.

For detailed information on how to author audio in the XACT tool, including information on categories, variables, and other advanced features, see XACT Audio Authoring.

To add a sound file to your game

  1. From the Start menu, click All Programs | XNA Game Studio Express | Tools | Microsoft Cross-Platform Audio Creation Tool (XACT). The screen that appears should look similar to the following:

    Bb203879.xact_tutorial_1a(en-US,XNAGameStudio.10).jpg

  2. The screen contains an empty project. In the empty project, you must first create a wave bank. To do this, click Wave Banks, and then click New Wave Bank. A new wave bank appears in the tree view under Wave Banks with the default name Wave Bank.

  3. Create a new sound bank. To do this, click Sound Banks, and then click New Sound Bank. A new sound bank appears in the tree view under Sound Banks with the default name Sound Bank.

  4. At this point, two new windows have appeared: one for the wave bank and one for the sound bank. To arrange these windows for easier viewing, click Window, and then click Tile Horizontally. The windows should now look similar to the following:

    Bb203879.xact_tutorial_4a(en-US,XNAGameStudio.10).jpg

  5. Add your wave files to the wave bank window. Make sure the wave bank window is active by clicking on it, and then click Wave Banks and click Insert Wave File(s). Insert one or more wave files into the wave bank. If you successfully added them, they appear in the wave bank window, which will look similar to the following:

    Bb203879.xact_tutorial_2a(en-US,XNAGameStudio.10).jpg

  6. For each wave listed in the wave bank window, drag the wave from the wave bank window to the sound bank window, and drop it on top of the Cue Name panel. XACT automatically creates a new cue that is linked to a new sound that plays this wave file. It should look similar to the following:

    Bb203879.xact_tutorial_3a(en-US,XNAGameStudio.10).jpg

  7. If the lower-left corner of the sound bank window does not have any entries, you must add entries to it by dragging each sound from the upper-left panel of the sound bank to the lower left panel of the sound bank. This action creates cues that correspond to the sounds.

  8. Now, to save the project, click File, and then click Save Project. Save the project to a location you can remember.

You are now ready to load and play sounds from this project in your game. See How to: Play a Sound for information on how to do this.

See Also

Tasks

How to: Play a Sound