I worked on the background music system today, since I didn’t have it in me to dive back into pixel art again quite yet — and I got all the hard bits figured out. But since “now there is music playing” is an uninteresting video, I made one of the improved item collection announcement. See it below:
I also wrote a bunch more NPC dialog and fixed several nasty bugs, but those likewise don’t make for interesting watching.
Streaming music with XNA is pretty easy to do and hard to figure out, like a lot of things in XNA. Here are the basic steps:
- Convert your music mp3s to raw .wav files. That’s right, XNA streaming supports only WAV files, and you’re far too lazy to write your own audio streaming library. I found this free mp3 decoder to be quite adequate.
- Next, you’re going to want to run the Cross Platform Audio Creation Tool (XACT) that comes with XNA. It’s in there, trust me. Dig. Then skim your way through this video to learn the basics of the tool.
- Then, in order to listen to any of the audio files in XACT, start up the XACT Auditioning Utility, a separate service that also comes with XNA.
- Finally, after swatting down the inevitable errors in the XNA content pipeline configuration, you’re ready to start where the XNA docs on this subject begin. Don’t worry, the sample project code doesn’t compile, so you won’t be distracted.
- And don’t forget to not check the .wav files into source control! A small repo is just barely worth the inconvenience of your build not working on a fresh machine.
I have four songs so far, which is about all I need for the playable alpha — getting closer every day!