Rip audio from a ds rom

Discussion in 'NDS - ROM Hacking and Translations' started by skarthebloodchild, Dec 24, 2006.

Dec 24, 2006
  1. skarthebloodchild
    OP

    Member skarthebloodchild Keep It Old School

    Joined:
    Jan 13, 2004
    Messages:
    2,215
    Location:
    Greece
    Country:
    Greece
    Hi,anyone knows how can i unpack a ds rom,rip the audio and pack the rom again?
    I want to do this cause castlevania portrait of ruin on supercard keeps crashing and i heard if i rip the audio less crashes will occur...
     
  2. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,719
    Country:
    United Kingdom
    lesson no 1 I had a nice reply lined up and firefox decided a 5meg XML would make it leak memory to all hell and crash.

    You can use NDSTool, NDSTS or NDSHV to unpack a rom. In this case (and 99% of other cases) the file you want is called sound_data.sdat

    Once you have this file you have two choices to help with the freezing issue.

    1) Delete the end of the sound file and in doing so delete the resource hogging sections. If using NDSHV or NDSTS then pad out the file with 00's to make it the same size as the original.

    2) Repoint the soundfile to avoid the resource hogging sections, I did this but only have a old version with me right now that I screwed up and lost all sound from so no patch until I sort that out. I will however lend a helping hand and give you my info on the sound file that I made up (sdattool crashes when trying to parse the later files which sod's law dictates are the files responsible for the crash). Search for FAT in ASCII using your hex editor to locate the file location table, from here you can replace the locations and sizes with another (smaller) section or a section of 00's.

    NDSTool:
    http://darkfader.net/ds/
    NDSTS:
    http://www.gbadat.altervista.org/tools.htm
    NDSHV:
    http://www.nintenren.com/ndshv/

    My xml file (I had to zip it as it was several megs in size, now it is less than 100KB):
    http://www.4shared.com/file/7846194/59a6fbf/PORsound.html

    Decent freeware Hex editor if you need one:
    http://www.chmaas.handshake.de/delphi/free...xvi32/xvi32.htm
     
  3. skarthebloodchild
    OP

    Member skarthebloodchild Keep It Old School

    Joined:
    Jan 13, 2004
    Messages:
    2,215
    Location:
    Greece
    Country:
    Greece
    With those tools i can unpack the files...
    How can i build the rom without hexediting?
    All those tools can unpack one file at once and not the whole rom files...
    Can you make me step to step guide to simply remove the audio from the castlevania rom???
    How can i use the xml you uploaded ?
    thanks
     
  4. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,719
    Country:
    United Kingdom
    NDSTS and NDSHV are GUI based apps so you just load up a rom and extract or import files normally using the mouse. While NDSTool can pull an individual file from the rom it is usually easier to use one of the others.

    NDSTool is slightly more powerful as it is able to completely rebuild the file system (the others need to replace files of the same size), it is however command line based which can in theory make things harder:
    Disassembly

    I have included a rename command so you can simply put the batch file, the uncompressed rom and ndstool in an empty folder and run the batch file to disassemble the rom, if you have the rebuilding batch file as well you can copy that across as it will not affect the process.

    Code:
    rename *.nds x.nds
    ndstool -x x.nds -9 arm9.bin -7 arm7.bin -y9 y9.bin -y7 y7.bin -d data -y overlay -t banner.bin -h header.bin
    Now you just have to run this batch file (it is essentially a program so just double click it) and a DOS prompt will flash up wait 30 odd seconds (depending on rom size) and the DOS prompt will close and on your drive in the same directory as the batch file and ndstool some folders will appear (data, overlay...) and a bunch of files will appear, now you can edit the rom as you please.

    Rebuilding/compiling:

    Code:
    ndstool -c xmod.nds -9 arm9.bin -7 arm7.bin -y9 y9.bin -y7 y7.bin -d data -y overlay -t banner.bin -h header.bin
    When you run this from the same directory as NDSTool and a previously disassembled rom it will make up a file called xmod.nds.

    Either way you can now get at the sound_data.sdat file to modify it using the methods I suggested above. The XML file is just a copy of the spreadsheet I made up with all the individual file locations and their size within it (files have some junk bytes between the end of the file and the start of the next) which you can use to help when repointing or deciding upon a place to chop the file.

    As for just replacing the soundfile (deleting rarely if ever lets the rom run again) grab one from another rom (goldeneye is a good bet as it is only a couple of KB) and then replace the original sound_data.sdat file before rebuilding.
     
  5. MisterAlex

    Newcomer MisterAlex Member

    Joined:
    Dec 25, 2006
    Messages:
    20
    Country:
    United States
    Not meaning to derail your initial question, but since this is very related, I wanted to tack on another to the first post.

    After extracting the sound_data.sdat, is it possible to pull out all of the actual audio (samples) from the data file such that I could end up with WAVs of the music or sound effects from the game? I'd really like to pull out the songs from Elite Beat Agents, you see.
     
  6. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,719
    Country:
    United Kingdom
    @MisterAlex yeah it is possible, I made some links the other day here: http://gbatemp.net/index.php?showtopic=410...=0&#entry526439
    This being said Elite beat agents will like not work with the tools so you will likely have to bust out a hex editor, for what it is worth though the audio quality may not be all that (DS audio is not all that and it the songs are likely (IMA-AD)PCM with a lowish samplerate) so other means of getting the songs would probably be better.
     
  7. Osha

    Member Osha Weh

    Joined:
    Jun 19, 2012
    Messages:
    602
    Country:
    France
    Ignore this.
     

Share This Page