Saturday, December 15, 2012

How To: Extract PCM Samples from a GBA ROM

This short tutorial shows how to easily and simply extract the audio sample data stored in GBA ROM images. A similar process can be used for many different types of ROMs.

 1. Acquire a .GBA ROM file from which to extract samples.


2. Open up Audacity. Create a new project. 

3. Go to File > Import > Raw Data. Navigate to the GBA ROM image file. Note the dialog that opens - allowing you to select: 
• Encoding (What sort of audio data are we expecting i.e. bit depth, format)
• Byte order (In which order are we expecting the bits to form each byte e.g. from lowest to highest bit or the reverse)
• Channels (mono / stereo - for many game ROMs this will be mono)
• Start offset (if you know where in the ROM the audio data is stored)
• Amount to import (if you know how much of the ROM space is used by the audio data)
• Sample rate: (at which rate do we need to play back the audio data so that it sounds correct in terms of speed / pitch)


4. For GBA ROMs, a good place to start is: 
Signed 8-bit PCM, No Endianness, Mono, 0 bytes offset, 100%, 12000Hz Sample rate. 


5. Audacity will import the raw data. 

If the settings selected in the import process are accurate or reasonably accurate, you should be able to see an area of the ROM (in the form of the audio waveform)  that looks significantly different to the rest of it.... 

An area that looks more like actual audio waveforms than a square data waveform.



 6. Preview the audio. If it does not sound correct, re-import the raw data and change the settings. Repeat this process until the audio sounds correct (as in, the same as the in-game audio). 

Once this has been achieved, simply trim the audio down by going to Edit > Remove Audio > Trim. 

Export this audio waveform by going to File > Export Selection and saving the file as a standard Wave file.




4 comments:

concretedog said...

nice post, ages ago I used audacity to replace sounds in gba roms...so I did wht you did, cut and pasted some audio out and into the file then exported from audacity as raw, into hexedit ( I think) and then exported the rom as .gba from there and hey presto!...had fun with pocket music I think.

Unknown said...

excellent

Unknown said...

excellent

Unknown said...

excellent