1. FAST6191

    OP FAST6191 Techromancer

    Nov 21, 2005
    United Kingdom
    Most people that hang around DS hacking eventually come across audio hacking which has been covered elsewhere but I feel like covering it again and maybe doing a bit more research into various things some of which was done as I was typing this up. As a rule of thumb everything that is not SDAT is a simple format, a known format, a wrapper of some form for a common format or something just wrapped around plain wave- to my knowledge there are no alternative tracker/sequencer formats with all the alt formats being some form of straight digitised wave form (although things can be layered across the various channels) save perhaps some of the things the music games do and maybe disgaea depending on how you look at it.
    I am not intending to go into music games and their formats with the aim of custom songs in those at this point but if it is there I will quite happily fiddle with it.

    To this end a quick overview of the state of things.

    The DS SDK format and one used by the vast majority of games however the games that do not use it with the possible exception of el tigre make my mule are noteworthy games in the DS library so it might well be worth the time having a look at the others. SDAT however is the container file for it all (occasionally you can see files outside them)
    It is a full audio format with three types of audio playback supported although there are helper files.

    SSEQ- analogous somewhat to midi and/or tracker formats

    SWAR (SWAV)- small PCM or ADPCM samples that either stand alone or are used as instruments for SSEQ.

    STRM- usually some PCM or ADPCM and can go right to full audio tracks (some of the Tony Hawk games had them including files outside the SDAT).

    The first hacks to it were simple swaps to lower file sizes when people were still using GBA era devices with as little as 16 megabytes of space on them (more often 32).
    Later some were sliced up and they kept working.
    After that came undubs where usually Japanese audio in the form of a whole SDAT file was stuck in a US or EU rom and it usually made the game have the Japanese audio. As localisation tends to just change things across most of the time this worked, when it did not work it was usually the fault of the rom packing tool (ndstool which some use standalone but more use with DSLazy or DSBuff is far from perfect for commercial roms) but the occasional rom does have a big change (megaman ZX and possibly Spectral Genesis)
    Around the same time it was discovered that Zoids Saga had an SMAP file in it- SMAP is a sort of info sheet generated by Nintendo's tools (although other programs can now generate them) which led to the whole SDAT format being reverse engineered. Occasionally other files like SADL are seen alongside the SDAT file.


    At first this mainly led to ripping the audio tracks (more on that in a moment) but later it allowed repointing hacks
    Later injection happened
    Alongside this the ability to generate SSEQ files happened
    http://sites.google.com/site/kiwids/ (see midi2sseq)
    More recently we got another one
    These days STRM and SWAV files can also be made and injected.
    Also with SSEQ being a proper tracker format (or close enough) you can edit the commands to change the audio however you will which culminates in the likes of
    http://pkmnhackersonline.com/romhacking/25/DS Music Hacking [LOOPING INCLUDED] (an older version)
    Tutorials covering some of the concepts with editing commands (mainly looping in SSEQ because several people like doing that) but if you know what goes you can probably do it by hand far more easily.

    Repacking a file into SDAT can supposedly be done with http://filetrip.net/f5658-NDS-Editor-0-1.html but that is a long shot so it is usually advised that you rebuild by hand or modify an existing file to accommodate you new file (pointers, section lengths and file lengths need changing)

    Ripping can be done in several ways
    The crudest is a line out from a DS into the line in/mic of your soundcard
    The second uses an emulator and a loopback option to grab sound (or maybe the emulator has sound grab abilities but it is the same idea)
    As running roms is no great issue these hacks can be helped along with audio hacks (repointing stuff) to either mute SFX and such or get end game tracks to play early on/at a quiet point. Equally with an emulator you can drop channels to leave whatever you want to play (most of the time it will be aimed at a given channel all the time).
    These two abilities hold for all audio ripping regardless of format.

    After this we have conversion which comes in one of two types
    SSEQ2midi style- these tools attempt to take sseq and approximate them to midi instruments.
    The aforementioned SSEQ2midi can do it
    http://code.google.com/p/loveemu/downloads/list (also includes some STRM and SWAV stuff)
    Various flavours of this exist but most are just minor bugfixes on the initial thing. It should be noted that Monster Tale ( http://gbatemp.net/index.php?showtopic=292661 ) has confused these tools so some work might need to be done there.

    NDSsndext (can also do the STRM and SWAV formats)
    http://filetrip.net/nds-downloads/utilities/download-nds-sound-extractor-0-4-f28818.html Originally from http://nintendon.s6.xrea.com/ but downloads of it no longer available there.

    It does a line in straight SSEQ to midi but it can also generate DLS files which can be combined

    Crystaltile2 supposedly has some playback but it is broken. It does however have a wonderful parser and information grabbing option

    After this you have proper emulation.
    VGMtoolbox combined with snakemeat and caitsith2's plugins/rip kits (might have to search a bit for those).

    Much like the nsf format and similar formats this emulates the audio so barring a few tiny quirks with the decoder libraries it is about 1:1 http://www.zophar.net/utilities/2sf/vio2sf.html has a foobar and co compatible decoder (which can then spit out a standard wave file to be used as appropriate).
    That is pretty much SDAT hacking covered, some stuff is still to discover and simple graphical tools are not as common as they might be but SDAT hacking is pretty mature. It is by no means a complete tools list either- several other nice tools exist here.

    pkg packed files.
    possibly just a packaged format- not seen so often for SDAT (indeed most packaged files kick SDAT out of the package and have it fly solo- see early phoenix wright and tony hawk games).
    Examples being El Tigre: Make my mule. Doing a strings search fo the ET.pkg there are some mentions of WAVE and SWAV
    A 32 bit flip will need to be applied if you are going to down this path.
    The pkg format appears to have a header (containing a lot of files by the looks of things)
    The initial 48 byte header has some stuff in it but following that is a file allocation table of sorts
    Entries are 52 bytes long
    Starts with name in ASCII (unsure as to longest possible "wireless_signal_strength.spr" being a longer example)
    Next is file number (counts up in hex)
    Next is possibly a flag (0100 being the most common but 0000 appearing a lot) Compression was not checked for but given the next two it could well be
    Next is some form of file size (probably decompressed)
    Next is another file size, 0000 flag entries are usually the same but the 0100 stuff is usually smaller (compressed size perhaps)- taking the location value from the previous one did have a tendency to generate this number but not enough were tested to see about padding.
    This is followed by the file location

    SWAV were not compressed/encrypted (had 0000 flag) and look like a standard one- imported as ADPCM at around 22050Hz into audacity well enough.

    wave just looked to be file names (SPX extension like most of the other files). Going off topic str, spr, fnt, txt, swav, scn, xml, csa, lua and dat being the other extensions (whether this is lua the programming language or not is a different matter- it has been seen in puzzle quest before though). Files seem compressed or encrypted though and it is not standard flag at the start of the file stuff not to mention it is not even the sort of half readable stuff you get with LZ (checked XML and txt).

    dat format (pending a better name) DSARC FL is the magic stamp in songs.dat msnd is seen in extensions, DSEQ is the magic stamp for the msnd files although DSARC is used elsewhere.
    Seen in Disgaea
    Alongside this seems to be a .tbl file which might have some good stuff in it.
    Curiously DSEQ and SSEQ are seen- 12 times for 13 header entries although it seems song006.msnd ( 0ED000 ) is repeated for whatever reason.
    File is 1FAE00 long
    Header on the file
    16 bytes initially
    00000000 4453 4152 4320 464C 0D00 0000 0100 0000 DSARC FL........
    48 bytes after that for each entry
    28 bytes possibly for names (none are very long)

    A search for SSEQ (note not the start of each section/file)

    If you prefer a search for DSEQ

    One tweaked header sample
    000314BC  00000400  song001.msnd....................................
    0002C1DC  00031A00  bgm_10.msnd.....................................
    0002E974  0005DC00  song003.msnd............................t.......
    00031C60  0008C600  song004.msnd............................`.......
    0002EA10  000BE400  song005.msnd....................................
    000128A8  000ED000  song006.msnd.............................(......
    0002FFDC  000FFA00  song007.msnd....................................
    000128A8  000ED000  song006.msnd.............................(......
    00027864  0012FA00  songJingle.msnd.........................dx......
    0003106C  00157400  song008.msnd............................l....t..
    0002EAF4  00188600  songJingle2.msnd................................
    000128A8  001B7200  song016.msnd.............................(...r..
    0003106C  001C9C00  song018.msnd............................l.......
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    00000000  00000000  ................................................
    the "song" part may be a name of sorts- several references to Jingle2.msnd are seen in the file.
    Pulling song001.msnd from the file and viewing that
    Appears to be a header section
    00000004 00000000 ....
    00000008 00000000 ....
    0000000C 00000000 ....
    00000010 00000040 [email protected]
    00000014 000060A0 ..`.
    00000018 00006400 ..d.
    0000001C 00000000 ....
    00000020 00006048 ..`H
    00000024 0000035C ...\
    00000028 0002B0BC ....
    0000002C 00054F60 ..O`
    At 40 there is data but at 30 there is SSEQ
    At 60A0 in the new file there is SNBK
    At 6400 there is SWAR
    (this seems to hold for other files)
    These are the three files needed for complete SSEQ playback,
    At 6078 the SSEQ file turns to 00 so that might be some padding/file length.
    035c could well be the length of the SBNK (if a 0000 is used to end the file)
    0002 B0BC could be the length of the SWAR as a 4 bytes later there comes the Jingle2.msnd "reference" and a bit more data before starting the next file.

    00054F60 might be playback help stuff

    More fiddling needed. A quick scan of BGM.dat looks like what is known so far is good.
    Also voice.dat and se.dat (now having files with the extension .se and .swav with the .swav appearing to correspond to the .se files) hold up. To this end it looks like a rejigged SDAT format. .dat.tbl files appear to grow in size with the amount of files contained within the dat files.

    Conventional Wave files.
    Used by Electroplankton. Music making games often have odd formats at their heart and Electroplankton has plain wave files as you can generate even with loads of tools. Related to the below format.

    BAR format (seemingly package files in this case for wave format)
    Brothers in Arms. A very odd game for hackers and pretty much forgotten.
    Everything is in "BAR" files with one named sounds.bar

    Looking at the other files they start with what could be simple pointers/locations with nothing else
    In the sounds.bar there are bunch of "RIFF" which is classic wave file behaviour- http://soundfile.sapp.org/doc/WaveFormat/
    Would be pointers line up fairly well although they appear to be offset (not checked how/how much) and there are more amounts of RIFF than pointers.

    Still straight extraction gives a apparently straight windows compatible wave file- some orchestral stuff for the tests at 32 bit float 22050Hz (22KHz- fairly standard low grade sampling rate) and mono.

    PCM audio.
    Used by N+
    This is a raw PCM audio format, better audio editors feature raw import (audacity http://audacity.sourceforge.net/ has the ability) and raw export is too troubling either.

    An old format seen back on the dreamcast and systems since but appeared on the DS as well. Games have been seen to split the difference between this and SDAT (Ninja Gaiden being a good example).
    Used by several games apparently http://www.cri-mw.com/product/adoption/platform/ds.html (note this can also include their video format and their file packing/handling stuff).
    First spotted in a basketball game but came to the fore in The World ends with you often referred to as TWEWY. It is pretty much a wrapper format for some MPEG audio of various flavours and several tools are capable of handling conversion to and from not to mention file system hacks are viable.
    wav2adx being the main tools here
    They can be found with a simple search but some downloads might appear at some point.

    DSE audio format.
    Home page in Japanese for the library http://www.procyon-studio.co.jp/dse/
    Some reverse engineering for the pokemon stuff http://projectpokemon.org/wiki/Digital_Sound_Elements
    GBAtemp thread http://gbatemp.net/threads/need-some-help-reversing-the-dse-audio-formats.405139/

    Seen in various extensions like .pb and has magic stamps/section stamps like SED SWD and SMD
    Seen in Inazuma 11
    From the relocalisation project

    Our guess as to what goes would be based on some of the magic stamps in the file and the history of DS audio it is likely some form of close to hardware decoding wave/PCM/IMA-ADPCM. If a straight undub did not work try making the file names the same and fiddling there.
    It appears to be one of the simplest packing formats on the DS with several things like it
    00000000 | 3244 5F30 3030 2E53 4544 0000 0000 0000 | 2D_000.SED......
    00000010 | 0000 0000 0000 0000 0000 0000 BC08 0000 | ................
    00000020 |3244 5F30 3030 2E53 5744 0000 0000 0000 | 2D_000.SWD......
    00000030 | 0000 0000 0000 0000 BC08 0000 C0CA 0100 | ................

    First line is file name

    First 14 bytes appear to be size (although flipping them gets a bit odd for really big numbers)
    In the second line BC08 flips to 08BC which is the start of a file (0000 in the first line indicates the file starts at the start of the file so that is not much use for reversing).
    The next line is 7CD3, looking back for a second you have BC08 C0CA 0100 or more accurately 08BC and 0001 CAC0, adding them rather nicely produces 0001 D37C. This is quite nice in rom hacking*- you saw the rest of the rom where things had 16byte alignment.
    *other roms/files like alignment so file start + length does not always equal next file start location.

    0001 D37C is where the next file starts.

    All names appeared to be filename.S?? so searching for .S yields 852 files. Add one as there is a file called Makefile which is detailed at 66C0 in the .ph file. Odd little files like this can make or break a rom hack so I looked at that.
    E875 4D02
    translates as

    050B long

    024D 7AF3 is the end which is rather nicely also the next file still (means things probably did not change as the file went on)

    It appears to do as it says on the tin, perhaps not quite as nice as princess maker, zoids saga stuff for sound or some of the other interesting things that have been dug out of roms over the years.

        # author : nozuru
        # memo   : データの追加・削除をした場合はcleanすること
        NUL                     =       /dev/null
        TOOLPATH        =       ../../Tool/packer
        PACKER          =       $(TOOLPATH)/packer
        BINDIR          =       bin
        INSTALLDIR      =       ../ ../ ../ina_main/data_iz/sound/ge
        SRCS            :=      $(wildcard *.SED *.SMD *.SWD)
        vpath %.pb $(BINDIR)
        all: makedir ge.pb
        ge.pb: $(SRCS)
        @$(PACKER) ..\\ge
        @mv ../ge.pb $(BINDIR)/sound.pb
        @mv ../ge.ph $(BINDIR)/sound.ph
        @mkdir -p $(BINDIR)
        install: all
        @cp $(BINDIR)/sound.p* $(INSTALLDIR)
        @-$(RM) -R $(BINDIR)


    SAD audio format
    Seen in Zombi Daisuki and possibly a few others. Usually sat alongside bin files with the magic stamp SIR0
    Pending further research one file list with sizes. Do note the game is quite interesting from a hacker perspective.
    1472 # sizedata.bin
    96 # volumedata.bin
    6048 # filelist.bin
    16912 # se_zo_vo_zombie_m5.sad
    13808 # se_zo_vo_zombie_m3.sad
    16304 # se_zo_vo_zombie_m2.sad
    22000 # se_zo_vo_zombie_m1.sad
    9728 # se_zo_vo_zombie_f5.sad
    4944 # se_zo_vo_zombie_f4.sad
    23520 # se_zo_vo_zombie_f3.sad
    16032 # se_zo_vo_zombie_f2.sad
    1593216 # bgm_zo_ev_99_epilogue_l.sad
    19744 # se_zo_vo_zombie_f1.sad
    15504 # se_zo_vo_swat_6.sad
    18048 # se_zo_vo_swat_5.sad
    26016 # se_zo_vo_swat_3.sad
    17776 # se_zo_vo_swat_2.sad
    13904 # se_zo_vo_swat_1.sad
    16032 # se_zo_vo_human_m7.sad
    20464 # se_zo_vo_human_m6.sad
    19200 # se_zo_vo_human_m5.sad
    14352 # se_zo_vo_human_m4.sad
    19888 # se_zo_vo_human_m3.sad
    5232 # se_zo_vo_human_m2.sad
    12880 # se_zo_vo_human_m1.sad
    34960 # se_zo_vo_human_f7.sad
    25216 # se_zo_vo_human_f6.sad
    19936 # se_zo_vo_human_f5.sad
    16864 # se_zo_vo_human_f4.sad
    16960 # se_zo_vo_human_f3.sad
    4976 # se_zo_vo_human_f2.sad
    5216 # se_zo_vo_human_f1.sad
    20464 # se_zo_vo_cameraman_6.sad
    17856 # se_zo_vo_cameraman_3.sad
    13728 # se_zo_vo_cameraman_2.sad
    15440 # se_zo_vo_cameraman_1.sad
    17296 # se_zo_vo_boss_9_7.sad
    21360 # se_zo_vo_boss_9_6.sad
    16080 # se_zo_vo_boss_9_5.sad
    25840 # se_zo_vo_boss_9_4.sad
    23440 # se_zo_vo_boss_9_3.sad
    33728 # se_zo_vo_boss_9_2.sad
    29280 # se_zo_vo_boss_9_1.sad
    17712 # se_zo_vo_boss_7_6.sad
    21360 # se_zo_vo_boss_7_5.sad
    29872 # se_zo_vo_boss_7_3.sad
    15680 # se_zo_vo_boss_7_2.sad
    22976 # se_zo_vo_boss_7_1.sad
    6768 # se_zo_vo_boss_6_6.sad
    8784 # se_zo_vo_boss_6_5.sad
    392624 # bgm_zo_title_l.sad
    19648 # se_zo_vo_boss_6_3.sad
    18976 # se_zo_vo_boss_6_2.sad
    18272 # se_zo_vo_boss_6_1.sad
    36608 # se_zo_vo_boss_5_6.sad
    20576 # se_zo_vo_boss_5_5.sad
    37504 # me_zo_gn_sortie.sad
    67200 # se_zo_at_death_meteor.sad
    15136 # se_zo_vo_boss_5_3.sad
    12448 # se_zo_vo_boss_5_2.sad
    10032 # se_zo_vo_boss_5_1.sad
    17440 # se_zo_vo_boss_4_6.sad
    20944 # se_zo_vo_boss_4_5.sad
    16752 # se_zo_vo_boss_4_3.sad
    15632 # se_zo_vo_boss_4_2.sad
    15376 # se_zo_vo_boss_4_1.sad
    14752 # se_zo_vo_boss_3_6.sad
    18624 # se_zo_vo_boss_3_5.sad
    29664 # se_zo_vo_boss_3_3.sad
    17680 # se_zo_vo_boss_3_2.sad
    8768 # se_zo_vo_boss_3_1.sad
    6352 # se_zo_vo_boss_2_6.sad
    7168 # se_zo_vo_boss_2_5.sad
    34576 # se_zo_vo_boss_2_3.sad
    28752 # se_zo_vo_boss_2_2.sad
    22144 # se_zo_vo_boss_2_1.sad
    15360 # se_zo_vo_boss_1_6.sad
    19200 # se_zo_vo_boss_1_5.sad
    31536 # se_zo_vo_boss_1_3.sad
    10352 # se_zo_vo_boss_1_2.sad
    6064 # se_zo_vo_boss_1_1.sad
    14864 # se_zo_vo_boss_0_6.sad
    18720 # se_zo_vo_boss_0_5.sad
    12336 # se_zo_vo_boss_0_3.sad
    15840 # se_zo_vo_boss_0_2.sad
    11504 # se_zo_vo_boss_0_1.sad
    7696 # se_zo_vo_zombie_m4.sad
    57920 # se_zo_ev_env_sand_l.sd
    56256 # se_zo_ev_eyes.sd
    106304 # se_zo_ev_farm_l.sd
    107008 # se_zo_ev_farm_sad_l.sd
    5408 # se_zo_ev_finger.sd
    15808 # se_zo_ev_fire_ignite.sd
    38272 # se_zo_ev_fire_l.sd
    8000 # se_zo_ev_fist.sd
    23744 # se_zo_ev_footwork_l.sd
    108416 # se_zo_ev_forest_l.sd
    25184 # se_zo_ev_gas_l.sd
    25888 # se_zo_ev_glass_01.sd
    33760 # se_zo_ev_glass_02.sd
    25792 # se_zo_ev_gun_01.sd
    25024 # se_zo_ev_gun_02.sd
    5152 # se_zo_ev_gun_set.sd
    17312 # se_zo_ev_gus_bottle.sd
    5280 # se_zo_ev_hammer.sd
    19360 # se_zo_ev_helicopter_l.sd
    7808 # se_zo_ev_homer.sd
    8256 # se_zo_ev_hotdog.sd
    31840 # se_zo_ev_howl.sd
    47712 # se_zo_ev_jet_l.sd
    11840 # se_zo_ev_ketchup.sd
    61312 # se_zo_ev_kiss.sd
    6944 # se_zo_ev_knock.sd
    11872 # se_zo_ev_landing.sd
    29120 # se_zo_ev_maj_eff.sd
    18048 # se_zo_ev_news_01.sd
    19552 # se_zo_ev_news_02.sd
    17632 # se_zo_ev_news_03.sd
    19392 # se_zo_ev_news_04.sd
    12640 # se_zo_ev_news_05.sd
    14912 # se_zo_ev_news_06.sd
    11392 # se_zo_ev_news_noise.sd
    9152 # se_zo_ev_paper.sd
    11296 # se_zo_ev_phone_button.sd
    25088 # se_zo_ev_phone_ringtone.sd
    34304 # se_zo_ev_rain_l.sd
    14944 # se_zo_ev_red_point.sd
    53184 # se_zo_ev_rumble_l.sd
    14272 # se_zo_ev_run.sd
    95328 # bgm_zo_ev_00_prologue_a.sd
    67168 # se_zo_ev_env_h_2_l.sd
    5440 # se_zo_ev_siren_l.sd
    21664 # se_zo_ev_sovetsky_laugh.sd
    5344 # se_zo_ev_splash_01.sd
    53472 # se_zo_ev_splash_02.sd
    5984 # se_zo_ev_step.sd
    12544 # se_zo_ev_step_back.sd
    36896 # se_zo_ev_step_slow.sd
    16128 # se_zo_ev_swat_call.sd
    16864 # se_zo_ev_switch_open.sd
    31232 # se_zo_ev_tank_l.sd
    10592 # se_zo_ev_timer.sd
    81344 # se_zo_ev_truck.sd
    3904 # se_zo_ev_turn.sd
    5920 # se_zo_ev_tv_noise.sd
    41952 # se_zo_ev_tv_noise_l.sd
    34688 # se_zo_ev_tv_noise_small.sd
    8096 # se_zo_ev_tv_off.sd
    53408 # se_zo_ev_tv_smile.sd
    2976 # se_zo_ev_umbrella.sd
    17824 # se_zo_ev_up_wipe.sd
    16352 # se_zo_ev_walk_l.sd
    50912 # se_zo_ev_wind_l.sd
    15712 # se_zo_ev_wink.sd
    9344 # se_zo_ev_zoom_01.sd
    89152 # se_zo_ev_z_wakeup.sd
    143104 # se_zo_farm_01.sd
    29408 # se_zo_sine_ex.sd
    9472 # se_zo_sine_exq.sd
    84512 # se_zo_soccer_01.sd
    94624 # se_zo_stage_01.sd
    12640 # se_zo_stage_02.sd
    13824 # se_zo_stage_11.sd
    9216 # se_zo_stage_12.sd
    13184 # se_zo_stage_13.sd
    10944 # se_zo_stage_14.sd
    13536 # se_zo_stage_15.sd
    15360 # se_zo_stage_16.sd
    15552 # se_zo_stage_21.sd
    22112 # se_zo_stage_22.sd
    15712 # se_zo_stage_24.sd
    21152 # se_zo_stage_25.sd
    18080 # se_zo_stage_26.sd
    21440 # se_zo_stage_27.sd
    10400 # se_zo_stage_28.sd
    21568 # se_zo_stage_29.sd
    28576 # se_zo_stage_30.sd
    13536 # se_zo_stage_31.sd
    12768 # se_zo_system_01.sd
    104448 # se_zo_ev_env_h_1_l.sd
    3872 # se_zo_ev_emergency_switch.sd
    16384 # se_zo_ev_electric_02.sd
    11264 # se_zo_ev_electric_01.sd
    28384 # se_zo_ev_eff_2.sd
    25824 # se_zo_ev_eff_1.sd
    10208 # se_zo_ev_drum.sd
    32736 # se_zo_ev_drip_l.sd
    84544 # se_zo_ev_drip.sd
    12576 # se_zo_ev_descent.sd
    11328 # se_zo_ev_creak.sd
    22240 # se_zo_ev_cow.sd
    19552 # se_zo_ev_collapse.sd
    9600 # se_zo_ev_clapper_02.sd
    5280 # se_zo_ev_clapper_01.sd
    89088 # se_zo_ev_cheer_l.sd
    90208 # se_zo_ev_cheer_2_l.sd
    24960 # se_zo_ev_cannon_set.sd
    49888 # se_zo_ev_cannon.sd
    12192 # se_zo_ev_break_02.sd
    38880 # se_zo_ev_break_01.sd
    43904 # se_zo_ev_bomber.sd
    11104 # se_zo_ev_bom.sd
    41728 # se_zo_ev_attack_shout_02.sd
    16224 # se_zo_ev_attack_cage_2.sd
    37024 # se_zo_ev_attack_cage.sd
    49344 # se_zo_ev_alert.sd
    17408 # se_zo_common_01.sd
    4704 # me_zo_gn_skill_up.sd
    3104 # me_zo_gn_gameover.sd
    3392 # me_zo_gn_clear.sd
    4320 # me_zo_ev_siren.sd
    95168 # bgm_zo_ev_00_prologue_b.sd
    11616 # bgm_zo_st_99_last_battle_l.sd
    8352 # bgm_zo_st_20_space_l.sd
    90784 # bgm_zo_st_18_garden_l.sd
    26656 # bgm_zo_st_10_fy_l.sd
    26656 # bgm_zo_st_10_fy2_l.sd
    8640 # bgm_zo_st_09_mm_l.sd
    8640 # bgm_zo_st_09_mm2_l.sd
    23456 # bgm_zo_st_08_sp_l.sd
    23488 # bgm_zo_st_08_sp2_l.sd
    9600 # bgm_zo_st_07_pk_l.sd
    10272 # bgm_zo_st_07_pk2_l.sd
    6784 # bgm_zo_st_06_ls_l.sd
    6784 # bgm_zo_st_06_ls2_l.sd
    8160 # bgm_zo_st_05_gd_l.sd
    8192 # bgm_zo_st_05_gd2_l.sd
    8576 # bgm_zo_st_04_om_l.sd
    8576 # bgm_zo_st_04_om2_l.sd
    9504 # bgm_zo_st_03_ht_night_l.sd
    9568 # bgm_zo_st_03_ht_night2_l.sd
    11072 # bgm_zo_st_02_ht_day_l.sd
    11072 # bgm_zo_st_02_ht_day2_l.sd
    13472 # bgm_zo_st_01_gw_l.sd
    13472 # bgm_zo_st_01_gw2_l.sd
    20128 # bgm_zo_st_00_home_l.sd
    3776 # bgm_zo_gn_swat_go_l.sd
    4736 # bgm_zo_gn_swat_arrival_l.sd
    2080 # bgm_zo_gn_swat_arrival_2.sd
    4000 # bgm_zo_gn_result_l.sd
    4000 # bgm_zo_gn_result_2_l.sd
    4320 # bgm_zo_gn_briefing_l.sd
    13760 # bgm_zo_gn_boss2_l.sd
    5728 # bgm_zo_gn_boss1_l.sd
    13248 # bgm_zo_gn_boss1_g_l.sd
    4320 # bgm_zo_ev_siren_l.sd
    67584 # bgm_zo_ev_news_l.sd
    77184 # bgm_zo_ev_farm_sad_l.sd
    76640 # bgm_zo_ev_co_chara_se_l.sd
    76448 # bgm_zo_ev_co_chara_l.sd
    25376 # bgm_zo_ev_30_rehome_l.sd
    95552 # bgm_zo_ev_29_missile_l.sd
    59488 # bgm_zo_ev_28_zreport_l.sd
    91232 # bgm_zo_ev_27_president_l.sd
    97056 # bgm_zo_ev_22_poison_l.sd
    97216 # bgm_zo_ev_18_military_l.sd
    82432 # bgm_zo_ev_15_ballad_l.sd
    48064 # se_zo_ev_shoot.sd
    84288 # bgm_zo_ev_01_start.sd
    31328 # se_zo_ev_shining.sd
    260 Files # 8659648 bytes

    Seen in Daigasso Band brothers (and sequel)
    Another music game with a custom format, reverse engineered and tools made to support it
    deufeufeu also did a fair bit of work but it seems a lot of it was lost.

    DSB format
    Seen in Taiko no Tatsujin at least. One of the few games to combine SDAT and custom stuff.
    various magic stamps in the file
    DSSB8- 64 bytes followed by 00 0000 hex leading to an ASCII name same as the file name up to 18 hex (00 padded if too short) 0100 0000 next for all files. A file length on occasion but often falls short. 40 and then padded with 00 until the next section for all files.

    DSST8- 64 bytes followed by 00 0000 hex leading to an ASCII name same as the file name up to 58 hex (00 padded if too short) alternated between ???? FFFF and 0000 0000 for the 0100 0000 section. ???? was usually quite large F6FF and such with many values repeating. Another length value (slightly smaller than the main one above) and all sort of fairly random stuff to make up the rest.
    BNSF (shortly after this it has sdat), perhaps not as long as the ones before it.
    Three entries regardless of size- someone mentioned easy and hard modes which could well be it.
    Between BNSF and S14 there appear to be 4 bytes given over to a size of some form.
    After BNSF there was usually SDAT but some had loop and then SDAT a line (16 bytes) later (many files with jingle in the name although several jingle files without it).

    After that came the data but nothing jumped out at me. It was densely packed and did not compress well which is classic digitised wave behaviour although with files ranging from under 10 kilobytes to just shy of 800 kilobytes it could mean several things.

    Seen in Super princess peach so far (another TOSE game causing fun).
    An actual custom midi style and wave sporting format. More on the thread linked, fairly basic archive format breaking down into what looks to be self contained song/audio packages.

    That over onto the thread. Feel free to add things if you want or point us at other interesting sound related formats or troublesome games.

    A common, patent free and open source, media format. Seen very often in PC games but no stranger to consoles either, handhelds are less common but an example for the DS can be seen in " WWE SmackDown vs Raw 2010 featuring ECW".
    http://gbatemp.net/threads/the-various-audio-formats-of-the-ds.305167/page-2#post-4250023 has more.

    A common, but so well liked among audio fans, sequenced format. Found in a few games but they might equally be developer leftovers.

    Custom XM
    Seen in a DSiware game. At present it was mainly reconstructed from running data rather than standalone decode.
    Reshiban, PokefanBrian and ratmandom like this.
  2. rastsan

    rastsan 8 baller, Death Wizard,

    May 28, 2008
    SAD can also be found in Inazuma Eleven2. The sound folder also has a .pb and .ph file with it. the sound .pb file is the largest in that folder. In case you wnated to investigate further.
  3. loco365

    loco365 GBAtemp Guru

    Sep 1, 2010
    I noticed the link to PHO. It's not been updated to the newer version of MIDI2SSEQ you found, but I have submitted a rewritten version (just today, in fact) that explains how to use it. I hope the admin will change it soon so it will be as accurate as I can have it. I might also post it here later on.

    By the way, you have a very exhaustive list of the DS sound formats. Kudos to you for gaining resources together for a well-written explanation of each of them. You'll definitely have your work cut out for you once 3DS formats are cracked. That is, if it can be cracked. That is, if we can even get a decrypted rom image.

    In fact, here: http://gbatemp.net/t305204-nintendo-ds-mus...fully-explained
  4. andibad

    andibad Soon™

    Sep 14, 2009
    Pokemon Mystery dungeon explorer of dark/time/sky is SWD,SMD,SED format in sound folder... i can't open these format.
  5. Blazer

    Blazer GBAtemp Regular

    Aug 10, 2008
    United States
    Bookmarked, this thread is so valuable and just what we needed, there's a lot of information on sound hacking for the DS but we need an ultimate guide of sorts to have it all organized. I hope you keep updating this with more information, even if it's links to other pages. Thanks.
  6. andibad

    andibad Soon™

    Sep 14, 2009
    I just wondering about 3DS ROM audio format [​IMG] yeah waiting until 3DS ROM is cracked
  7. muguk

    muguk Member

    Jun 16, 2010
    It's over a year since I ripped any music, so getting back into it and this thread is really useful info. Many thanks.

    MOD/XM etc.

    These are also the old-school module trackers used .. some are the ancient 4-channel .MODs but the majority are .XM files (up to 16 channels).

    A recent example of .XM files can be found in: Witches & Vampires - Ghost Pirates of Ashbury


    Another one, which seems to be 16Khz mono PCM sound is: SDF (there's a small header) but they playback fine under a RAW import on Audacity. Found in: ATV Quad Fury.
  8. FAST6191

    OP FAST6191 Techromancer

    Nov 21, 2005
    United Kingdom
    First thanks for that muguk- new formats are nice to see and proper use of conventional tracker formats is new as far as commercial roms go.

    Anyhow I picked a random rom to pull apart from whatever I had sitting around, today's victim was go go cosmo cops but other that noting another use of the BMG text format, some small "debug" 3d model files and a file called rollingstones2.ntft, which was indeed the logo of the band in the filename, it was fairly standard. Were it not so compression heavy (although all that I saw was conventional LZ (10 and 11) and named to indicate it) I might even suggest it as a learning to hack rom (lots of nice filenames, mainly SDK formats, level formats looked like they might be alright and the ASM was not that bad either).

    To this end I ended up pulling Zombie Daisuki apart again and I got to try my hand at the sound formats again.
    SIR0 now appears to be a more conventional packing/archive format- it is used elsewhere in the rom for various things. Alongside this most of the time the SIRO files seem to be partnered up with other formats.

    00000000 5349 5230 C800 0000 E000 0000 0000 0000 SIR0............
    00000010 0000 0000 0000 0000 0000 0000 0000 0000 ................
    00000020 5343 5F65 7665 6E74 5F70 725F 3031 00AA SC_event_pr_01..
    00000030 6165 705F 6576 656E 745F 7072 5F30 3100 aep_event_pr_01.
    00000040 6165 705F 6576 656E 745F 7072 5F30 315F aep_event_pr_01_
    00000050 7600 6C61 7965 722E 706E 6700 5B63 656E v.layer.png.[cen
    00000060 7465 725D 82BB 82CC 82E6 82E9 0A5B 6365 ter].........[ce
    00000070 6E74 6572 5D5B 706C 6179 6572 6E61 6D65 nter][playername
    00000080 5D82 CD0A 5B63 656E 7465 725D 82E4 82DF ]...[center]....
    00000090 82F0 82DD 82BD 0A00 2000 0000 3000 0000 ........ ...0...
    000000A0 4000 0000 5200 0000 5C00 0000 0200 0100 @...R...\.......
    000000B0 0200 0300 0000 1900 0300 0400 FF00 FF00 ................
    000000C0 FF00 0100 0700 0800 0000 0000 AC00 0000 ................
    000000D0 9800 0000 AAAA AAAA AAAA AAAA AAAA AAAA ................
    000000E0 0404 8110 0404 0404 2404 00AA AAAA AAAA ........$.......
    000000F0 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA ................
    SIR0 is followed by a byte flipped value (up to 4 bytes) that points towards the end of the file. At which point long runs of AAAA (alternating 1 and 0 in binary) bound some other data. The amount of AAAA changes as well seemingly with the size of the file (although being an archive format that could just mean a lot of files contained within) but I am still going to call padding.
    However within that is the location of the files that seem to be contained (it matches with what is below), flipped pointers to the file locations (standard pointers using the start of the entire file)
    There is a second pointer that points after the locations pointer. No idea what this is (it does not appear to be sizes and can end up quite long).
    However looking at the rather long parameter.bin elsewhere in the rom the SIR0 format almost seems to be doing double duty as a database index of sorts (a long list of what could be very little other than variable names immediately ending and pointers start pointing at)

    Back to the music it means I am largely ignoring the SIR0 stuff for now. Several small strings crop up in various .sd files
    Capitals of the filename
    eod (end of description?)
    smdl or sedl
    Another capital name
    song or if it is sedl above then seq
    trk (several times usually but sedl/seq types tend to be less keen)
    eoc usually closes out the file (ignoring the AAAA stuff) (end of content?) however
    if sedl and seq are there after eoc comes mcrl
    Another capital name
    eod (then AAAA stuff)

    For my money this points to a sequenced type (sedl- seq and the extra files in general would be banks and bnkl....) and either a simpler sequencer (SFX rather than some music) or a more conventional wave type affair (for smdl). Looking at a handful of the filenames those with me_ (of which there are only 4 and all are smdl) and bgm_ (not tested all yet) starting their filenames are smdl and those with se_ are sedl which would appear to back that up.
    Now pulling apart (comparing will come later)
    me_zo_gn_gameover.sd (smdl)
    se_zo_ev_umbrella.sd (sedl)
    Both have lost up to 20h (what I am going to call the SIR0 header)
    me_zo_gn_gameover.sd (smdl)

    swdl - 0000h (would have been 20h if I had left the header on- SIR0 matches up)
    Capitals of the filename- 0020h - Missing the ER from the file name ( "ME_ZO_GN_GAMEOV" )
    wavi - 0050h
    prgi - 01b0h
    kgrp - 0470h
    pcmd - 04b0h
    eod - 08f0h
    smdl - 0900h
    Another capital name - 0920h - also missing ER as before.
    song - 0940h
    trk - 0980h (20)
    trk - 09A0h (50)
    trk - 09F0h (138)
    trk - 0B28h (88)
    eoc- 0BB0h

    Bracketed sections= length of section. None apparent in the file.

    No immediately obvious pointers but the wavi section does have 3 very similar but not identical 64 byte sections,
    The wavi differences could be volume, length (pointers) and similar things. Trouble is 4 trk sections that look quite valid although the first is only 20h long.
    swdl has 0090 (0900) in the traditional 8h offset and this is the length of the section (smdl appears at 0900h) but this is not the eod value.
    smdl is followed by C002 (02C0) which also follows the 8h from the start of the section tradition and which would be the end of the section/start of the AAAA stuff) although not the eoc value. The trk also has identical runs of 7472 6B20 0000 0001 04FF 0000 (74726b = ascii trk)


    swdl - 0h
    Capitals of the filename - 20 - SE_ZO_EV_UMBREL (looks like it could be a limited length section for the name)
    wavi - 50h
    prgi - b0h
    kgrp - 160h
    pcmd - 180h
    eod - 5f0h
    sedl - 600h (as predicted by the SIR0) and length value up to end of file (mcrl and bnkl included) at sedl + 8h
    Another capital name - 620h - Also as before
    seq - 640h
    trk - 690h (a solitary one here)
    eoc - 6b8h
    mcrl - 6d0h
    Another capital name - 984h - SE_ZO_EV_UMBRELLA this time.
    bnkl - b00h
    eod - b30h(then AAAA stuff)

    bnkl is nothing like the sbnk form (SDAT soundbank) and appears far simpler.

    sad format appears far less complex
    sadl at 0h
    file length at 8h
    name at 20h (also cut down)
    No other stamps.

    Equally I managed to get something resembling the audio when forcing import raw in audacity. I did not manage to get close to the actual settings though (granted the difference between perfect import and lots of noise is very little) as I am no good at that sort of thing. I looked at the sound registers on the DS via desmume (odd sample rate of 32728.5Hz apparently for some but varies quite a bit) along with various mixes of PCM16 and IMA-ADPCM which my install does not seem to have a great version of). Maybe with a repoint hack in the near future.
    I will call audio starting at 100h and the first part being the header (I scanned through all and there were parts that changed and parts that did not).

    Sadly there did not appear to be much on audio in the download play component or I might have considered pulling apart that from an ASM perspective (always nice when the person making stuff provides you with a cut down version to pull apart).

    Also in the rom are files with the extension prp and the magic stamp ATLZM and AT4PX (somewhat less common in a quick scan by eye and by hex editor there are 636 hits including multiples in a file vs 1932 of the ATLZM). Looking around at some of the references it should be somewhat conventional formats inside it but unlike most compression I still do not see it (no obvious flags), however it does appear compressed already as compressing makes no real difference. Somewhat unusually they do not appear to be 16 bit aligned and data will follow others. ATLZM is immediately (as in on the byte boundary rather than at the 16 bit mark) followed by a length value that points at ATEEE and AT4PX has a similar arrangement but houses multiple files (at least it does in the case of pict_st_21_stadium_0.prp which also has a SIR0 E bytes later and that is also not aligned)
  9. muguk

    muguk Member

    Jun 16, 2010
    No problem. I dip in and out of hacking the music. It's not like 20 years ago when I was sat in front of MonST stepping through 68000 to find the latest piece of Atari ST chip music. I get bored too easily now :)

    All my previous work (as in the copies available online and my tutorial) were all hosted at ... .MegaUpload :( Hey ho .. start again!

    But tonight I thought I'd have another go but hit problems with VGMTrans & BitDefender 2012.

    BitDefender 2012 really *doesn't* like VGMTRans - tried VGMTrans_src_and_bin_9_29_09 & VGMTrans_src_and_bin_8_29_09 - both versions get flagged by BD's Firewall and then are blocked. I unblock them and allow them to run (not sure what it's going online for ..) and then BD feels I'm ignoring its advice and deletes the .EXE! Can't unpack the .ZIP file - as soon as it finds the .EXE, it stops the extract.

    Is there any other tool like VGMTrans (or a newer BD-compliant) version out there? I'm specifically after the Soundbank->DLS conversion that VGMTrans did so well :)
    I had a look at VGMtoolbox and it's nice 'auto-rip of all SEQ & BNK files' but .. the old lazyitis kicks in and I long for VGMTrans' ease of use.
  10. FAST6191

    OP FAST6191 Techromancer

    Nov 21, 2005
    United Kingdom
    Yeah there is a long history of rom hacking tools getting flagged by AV programs although usually being packed/script based, containing other executables, existing solely to modify other files and occasionally with a web grab would scream virus to all but the worst heuristics. Most of the time you just push through it or stick it in a VM.

    As for the matter at hand I ditched VGMtrans (and ndssndext) for VGMtoolbox about as soon as I figured it out (I have no great need for DLS files) and have not really felt the need to go searching for something else. I have not noticed anything coming out of China or Japan lately (although I probably should link up http://asmodean.reverse.net/pages/tools_index.html as I have not seen it linked up around here) and there might be something in the pokemon world but I have the pokemon induced narcolepsy so I rarely get far when wading through pokemon related threads. VGMstream ( http://hcs64.com/files/?C=M;O=D ) seems to be heading down the path of wave type music for various formats though so that is out. Not sure where http://www.assembla.com/code/sdat4as/subversion/nodes / http://megaswf.com/serve/1165043 is at though but probably wants a link alongside all this.

    Oh and on the subject of XM files along with the cri middleware link that I already gave out I stumbled across http://www.engine-software.com/ (warning- all flash site) the other day that touted a XM playback library that was in active use in commercial games when doing some research for the game of the week articles. It has nothing special in it (the cri middleware one stated a few games their tech was used in) but more info is always nice.
  11. muguk

    muguk Member

    Jun 16, 2010
    Strangely enough, installing Virtual PC for Windows was one of my tasks earlier on this evening for that very same reason :)

    The DLS files are a necessity (for me and whoever I give the music rips too) as they either need the MIDI+DLS for remixing or use the Impulse Tracker conversions I do. Personally, I use the .IT files on my phone but the musos I know like to have the soundbanks for their projects.

    I'll sort out an updated list of those using 'old skool' trackers when I get some time tomorrow. Been catching up with the newest titles so once I've got the VM setup as I would use it, I'll be back on track. Maybe this time I'll work out why Burnout sounds so awful / out of step once it is playing inside Impulse Tracker :)
  12. mrgone

    mrgone old man

    Nov 6, 2002
    wouldn't it be useful, if this would be stickied?
  13. muguk

    muguk Member

    Jun 16, 2010
    Oops - completely forgot about this thread. Virtual Windows XP installed .. just doing the 89 Windows Updates needed for it. Then I can continue with my investigation(s) :)
  14. FAST6191

    OP FAST6191 Techromancer

    Nov 21, 2005
    United Kingdom
    Wayback machine decided to spit out some of the tahaxan SBNK stuff when I looked today (although nothing else really and I went through all the non forum stuff), we had the tahaxan SSEQ stuff already thanks to Orengefox
    Neither has much more than lowlines released in the older specs http://www.romhacking.net/documents/469/ (newer ones without anything on sound but lots more on 2d and 3d graphics http://llref.emutalk.net/docs/ ) but they are a bit nicer to read than some of the programming centric stuff in most other specs that are out there.

    Once again it seems I should have backed things up (I was actually thinking I really should back it up about a week before it went down and that was not the first time in life I have done that) but hey.


    'SBNK' stands for "Sound BaNK". There is info about samples and instruments. This is not really a file, but part of SDAT files.

    Example file: BANK_BGM.SBNK from "Zoo Keeper".

    SBNK section FieldStartEndSizeExampleDescription Magic stamp0x000000000x000000034 bytes"SBNK"Magic stamp.Unknown constant0x000000040x000000074 bytes0x0100FEFFThis always appears with this value Section size0x000000080x0000000B4 bytes0x0000089CSize of this section always matches with file size (includes header)
    Header size0x0000000C0x0000000D2 bytes0x0010This is going to be always 0x0010, because size of the header is always the sameNumber of sections0x0000000E0x0000000F2 bytes0x0001Number of sections included inside "SBNK" section DATA section FieldStartEndSizeExampleDescription Magic stamp0x000000000x000000034 bytes"DATA"Magic stamp. "DATA", nothing more, nothing less ;) Section size0x000000040x000000074 bytes0x0000089BSection size, including header
    Just like other files, 'DATA' section have a semi-standard header. And now, follows the data.Unknown constant0x00000008
    0x0000002732 bytes
    0x00..0x00Seems for padding, but it doesn't have any sense... Number of samples0x000000280x0000002B
    4 bytes
    0x00000080This is the number of samples / instruments / whatever found in this bank. Unknown type
    1 byte0x02This is some sort of type. Doesn't know exactly what is for, but pointed data changes according with this number
    Data offset
    3 bytes
    Offset ABSOLUTE to the archive, pointing to start of sample resource data...and there is 'Number of samples' pair of fields like this one. Format for data pointed by this offsets changes according to "Unknown type" as follows: (ABSOLUTE offsets this time)"0x01" and "0x02" type:
    Sample number
    0x0000023C0x0000023D2 bytes
    0x0003Number of sample contained in SWAR fileUnknown flag
  15. Gericom

    Gericom GBAtemp Maniac

    Jun 30, 2011
    Mkds course modifier can play sseq with sbnk. It can also convert sseq to midi and sbnk to dls.
  16. loco365

    loco365 GBAtemp Guru

    Sep 1, 2010
    Well, while I'm reading this, in my development of my tutorial, I've noticed that not a single program can extract the direct sounds from the game. I know they're not stored in the game, but is it possible to have them extracted into a DLS file when you go to rip the audio?
  17. Gericom

    Gericom GBAtemp Maniac

    Jun 30, 2011
    I don't know what you exactly mean, but sbnk can only be converted with the samples. Which are in the swar files. In mkds course modifier you have to open the sdat. Open the sseq then and it will be played with sbnk. It also supports looping.
  18. loco365

    loco365 GBAtemp Guru

    Sep 1, 2010
    If you grab a HGSS rom and try playing the GB Sounds themes in VGMtrans, you won't hear anything because the 8-bit sounds it's using are direct, not sampled. And when you log to DLS, it's the same result.

    They've worked in NDS Music Player since @KazoWAR added direct sound support.
  19. Gericom

    Gericom GBAtemp Maniac

    Jun 30, 2011
    I will look at it. But did you try mkds course modifier playing allready? With loop?
    Can you send me the sdat by the way?
  20. loco365

    loco365 GBAtemp Guru

    Sep 1, 2010
    I can't really link you to the SDAT as it's still copyright but if you get a rom, it's in /data/sound/gs_sound_data.sdat.

    As for using MKDS Course Modifier, I can't get it to use the game's banks, it only plays general MIDI. Unless there is a setting for that?
Draft saved Draft deleted

Hide similar threads Similar threads with keywords - various, formats, audio