gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > N00b in distress

#7303 - Daikath - Sat Jun 14, 2003 11:34 am

I am trying to find out how to convert a pcm wave file into a header file or something source cody I can use in my source code but I cant find out how.

I have tried the programs to be found on gbadev.org but all don't work so can someone explain to my like I'm a four year old how to convert a pcm wave file into something source cody?
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?

#7316 - DekuTree64 - Sat Jun 14, 2003 9:16 pm

First, you get yourself an audio program (I use one called CoolEdit, which you may be able to find on www.download.com. It's pretty old though, but I think GoldWave would work too)
Then you load your .wav file into that, and save it as raw PCM data, and either write your own little program to read the file and output the data as a C array, or download http://www.devrs.com/gb/files/b2x.zip and save yourself the trouble. That will get you the sample data, but you'll need to make your own system for knowing the frequency/length. I just use 3 arrays, one that has pointers to the sound data, one with the frequencies, and one with the lengths. Actually 4, since I have one for looping positions too.

#7320 - Ninja - Sat Jun 14, 2003 11:52 pm

I use the Techtronic Wave program on gbadev.org.

I immediately clear out all the extra stuff though, such as the header created, and some of the excess structs and stuff. I just rename the array with the wav data in it to whatever I want, and I include it in my make file.

Simple as that. :)