Thursday, September 27, 2007

XACT: Cross Platform Audio Creation Tool (from Hell)

After explaining to Robert how difficult it was getting XACT to work, he told me I should put the story up on the blog, so here it is.

Keep in mind that I had not watched the tutorial video on XACT which can be found here:
http://msdn2.microsoft.com/en-us/xna/bb245766.aspx

That would've helped out a bit. (Information that would've been useful to me yesterday, as Adam Sandler would say.)

My goal was to simply get the main menu music to play. 

  1. I got my mp3 (Crisis.mp3).
  2. I used Audacity to convert it from .mp3 to .wav.
  3. I started XACT.
  4. There are Wave Banks and Sound Banks. I added Crisis.wav to the Wave Bank.
  5. I went into the Sound Bank and clicked "New Sound."  A "Sound" is a container for events. An event is something like "Play Wave."
  6. I renamed my New Sound "Crisis."
  7. I dragged Crisis.wav from the Wave Bank into the "Crisis" Sound I just created, and it created a "Play Wave" event for me. Robert and I assume it's done like this so you could play multiple sounds at once, like "thunder.wav" and "rain.wav" could become a "Thunderstorm" sound.
  8. I changed some settings on "Crisis" so that it would fade out at the end.
  9. I created a New Cue and named it "MainMenuMusic."  A Cue is basically a playlist, or a container for Sounds.
  10. I dragged the "Crisis" Sound into my "MainMenuMusic" Cue.
  11. I saved my XACT project.

    This is the true end of the XACT steps, but I had to try to play the sound...
  12. I tried to play the Cue directly from XACT, but I got an error because I didn't have the XACT Auditioning Utility running.
  13. I started the XACT Auditioning Utility.
  14. Tried playing again. Nothing. Not an even an error this time.
  15. Closed the XACT Auditioning Utility.
  16. Closed XACT.
  17. Started the XACT Auditioning Utility.
  18. Started XACT.
  19. Opened my XACT project.
  20. Played the cue, and damn if the music didn't start playing! Yes!

    Back to the C# Game Project
  21. I modified my code to be soundBank.PlayCue("MainMenuMusic").
  22. I built my C# game project.
  23. I ran the game and lo and behold, I see my new main menu and "Crisis" is playing in the background. That was cool.
  24. I actually go to sleep and don't think about the game for the rest of the night.

Now, if I had been smart, I would've watched the tutorial video first.  If I'd done that, I could've skipped some steps, as apparently you can just drag the wave straight from the Wave Bank to the Cue section and it creates a Cue and a Sound (with a Play Wave event) for you automatically. Dang.

No comments: