Blog'A'Little

Just another C# guy

Compressing audio in Xna for Windows

Xna does not support MP3 or WMA, neither on Xbox or Windows. For Xbox you have a format called XMA that is pretty much like WMA on Windows, but for Xna for Windows you have to resort to uncompressed (PCM) or close to uncompressed (ADPCM). This tutorial shows you how you can use ADPCM and get at least some compression for your sounds and save a bit of space. The average compression rate is 27% for the default settings.

We will be using XACT (Microsoft Cross-Platform Audio Creation Tool) that comes with both Xna 1.0 and 2.0.

Create a new project by going to File->New Project (Ctrl +N) and create yourself an empty project.

image

You then get a screen looking something like this:

image

First we will create a compression preset by right-clicking the compression presets and select new compression preset:

image

Give it a name, so you'll recognize it later on in the process.

Now we need to select ADPCM and samples per block:

image

We'll leave the samples per block to 128, which is default. The quality of the sound is quite good with this setting.

Now we need to create a wave bank by right-clicking the wave banks in the project and choose new wave bank:

image

Leave the default settings for now.

You're then given a window where all your wave files will exist for that particular wave bank. Here we can insert our wave files.
Just right-click inside the window and choose to insert wave files:

image

Select your wave file:

image

We can now select the compression preset we want to use for the imported wave by selecting the wave file and then selecting the correct preset in the properties in the lower left of the application:

image

Now we need to create sound bank by right-clicking the sound banks and choose new sound bank:

image

Open your wave bank and select the wave file you want to be cue in the sound and drag it from the wave bank onto the cue part of the window.
The result should be something like this:

image

You now have a project you can build and use from your solution programmatically.

kick it on DotNetKicks.com kick it on GameDevKicks.com

Comments

GameDevKicks.com said:

You've been kicked (a good thing) - Trackback from GameDevKicks.com

kick it on DotNetKicks.com kick it on GameDevKicks.com
# april 2, 2008 11:20

grand-gambler.com said:

good story, all laid out on the shelves

kick it on DotNetKicks.com kick it on GameDevKicks.com
# april 1, 2010 3:52

panasonic wireless cameras said:

Immense early areas grow communications in side of materials and are often a dynamism of magnetic speeds.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# mai 19, 2010 7:34

payday loans online said:

Your website is very interesting. I enjoyed your website a lot. Thank you.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# juli 2, 2010 7:17

payday loans said:

Your weblogblog site is excellent. Give thanks to you very much for sharing a great deal of valuable critical information. Most definitely i'll bookmark your website and will be definitely coming back. Once again, I admire your work and also sharing such an abundance of vital related information to the readers.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# august 25, 2010 3:42

loans british columbia said:

uqpaurcycvxghghtaeiknthsmtzdldgqwil

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 2, 2010 3:24

canadian payday loans said:

Easily, the post is really the greatest on this laudable topic. I concur with your conclusions and will thirstily look forward to your future updates. Saying thanks will not just be sufficient, for the fantastic lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Solid work and much success in your business enterprise!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 22, 2010 4:13

payday loans no fax said:

I will post a link to this blog on my site. I'm sure my readers will find this info really good. prvfchcqjiz

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 23, 2010 3:06

loans online no fax said:

This article gives the light in which we can observe the reality. This is very nice one and gives in-depth information. Thanks for this nice article.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 26, 2010 3:20

loans canada said:

This article gives the light in which we can observe the reality. This is very nice one and gives in-depth information. Thanks for this nice article.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 26, 2010 1:06

loan canada bad credit said:

Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 27, 2010 1:59

http://chrvhj.com/ said:

LjWAjoiI

kick it on DotNetKicks.com kick it on GameDevKicks.com
# januar 31, 2011 6:08

http://shopinq.com/ said:

4A7htZ comment2

kick it on DotNetKicks.com kick it on GameDevKicks.com
# januar 12, 2012 11:43
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Design downloaded from Free Templates - your source for free web templates