the black hole 
it all ends here. 
bhC login
name:
pass:
 
home
 
 the black hole's front page. all the latest vb rpg development and vbgaming news, as well as this week's feature rpg project!
articles
 
rpg theory (7)
directx in vb (3)
vb rpg programming (4)
miscellaneous (4)
files
 
rpg / tile engine source (23)
full vb games w/ source (5)
'helper' libraries and utilities (13)
effect samples (5)
miscellaneous (10)
rpg projects
 
 vb rpg projects under development by members of the bhC. show them your support, and check out their games!
message board
 
 a forum to interact with your fellow vb rpg programmers. you do *not* have to be a bhC member to post!
links
 
vb rpg programming (5)
vb gaming (14)
general game programming (6)
vb sites (6)
miscellaneous (2)
general rpg programming (2)
contact
 
 you want to contact the guy behind the black hole? here's where to do it!


 
 


<< Back to Category List

MP3's and Direct Sound - page 1


pages: prev | 1 | next
Mp3's and Direct Sound By Brian Clark

Have you ever wanted to use mp3's as the background music for your game? Easy right, load an mp3 file instead of a wav file, and hit play! WRONG, even though mp3s have been popular for quite some time Miscrosoft didn't add ANY support for them in Direct Sound(Why Not?). But not to worry there are other ways of using them with directsound!!

What I will show you involves compressing a wav file with "MPEG-Layer 3 Compression", but results in a normal .wav file that can be played(with a codec) though DSound. The process of performing this conversion is actually quite simple. Because direct sound decompresses the whole file on load there is no performance hit, but the load time suffers a little. Ok, well here is how you do it:

Well were not ready just yet, the compression codec MUST be installed on you system before you can encode your files. To install it just download this file: l3codecp.exe which is the FHG MPEG II Layer 3 audio codec profesional version developed by Fraunhofer. This is the profesional version which must be bought for a hefty sum(how do I have it you ask, don't worry about that just download it already), there is also an advanced version l3codecp.exe which is free, but can only encode at rates upto 56kbps. Well on with it, all you need to do after downloading this is double click, and it should do the rest.

The only catch is that your users must also have this codec installed, but I think the advanced version comes automatically with Win98+, or with IE4. But just in case I plan on writing a vb module that takes care of installing it for you, but in the meantime just have them install it, or hope they have it. For more info on codecs and such check out these pages:

http://www.audiograbber.com-us.net/codec.html
http://www.iis.fhg.de/amm/techinf/layer3/

One more thing while we are on the subject of codecs, to check which ones you have installed go into Control Panel|Multimedia|Advanced|Audio Compression Codecs, and you should be able to find out anything about them.

Now for the easy part, once you have done all that just follow these easy steps, and you should be on your way!

Step 1. Open the *.wav file in Windows Sound Recorder (Start|Programs|Accesories|MultiMedia)
Step 2. Load the file in Sound Recorder
Step 3. Goto Properties (File|Properties)
Step 4. Click Convert Now
Step 5. For format Select "MPEG-Layer 3", for Attributes select the bitrate
Step 6. (Optional) Click "Save as" to give the settings a name(I use MP3)
Step 7. Click Ok until you are back at the main window
Step 8. Save it! (File|Save)

Last thing, to play the encoded wavs with direct sound is no different then playing a normal wav file. I am not going to explain that whole process, but instead here are a few links to tutorials for doing that:
Lucky's Direct Sound Tutorial
http://members.home.com/theluckyleper/tutP.html

VoodooVB's Direct Sound Tutorial
http://www.redrival.com/voodoovb/DirectSound.htm

DirectX4VB's Direct Sound Section
http://64.23.12.52/Tut_5.htm

Well Since david doesn't allow links in his tutorials, the codec files can be found at my website: http://www.redrival.com/dvrealms/

Well, thank you for reading this tutorial I hope you found it useful and educational. If you have any more questions or comments PLEASE email me at troll1184@cs.com

Thanks Again,
Brian Clark


pages: prev | 1 | next