Export (0) Print
Expand All

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 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, then click XNA Game Studio 2.0, click Tools, and finally click Microsoft Cross-Platform Audio Creation Tool (XACT).

  2. Start by creating a new project by clicking the File menu, then New Project. You will be asked for a location and a name for your project. Enter a name and a location you can remember, and click OK. The project will be created, and the screen will resemble the following:
  3. Bb203879.xact_tutorial_1a(en-US,XNAGameStudio.20).jpg
  4. 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." Press ENTER to accept the default name.
  5. 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." Press ENTER to accept the default name.
  6. 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.20).jpg
  7. 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.20).jpg
  8. 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.20).jpg
  9. 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.
  10. Save the project. Click File, and then click Save Project.

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.

Community Additions

ADD
Show:
© 2014 Microsoft