The various audio formats of the DS

Discussion in 'NDS - ROM Hacking and Translations' started by FAST6191, Aug 15, 2011.

Aug 15, 2011
  1. FAST6191
    OP

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,696
    Country:
    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.

    SDAT
    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.

    http://www.romhacking.net/docs/469/
    http://kiwi.ds.googlepages.com/sdat.html
    http://gbatemp.net/t253947-nintendo-sdat-specifications?view=findpost&p=3154732

    At first this mainly led to ripping the audio tracks (more on that in a moment) but later it allowed repointing hacks
    http://gbatemp.net/index.php?showtopic=122534&hl=
    Later injection happened
    http://jul.rustedlogic.net/thread.php?id=7518
    Alongside this the ability to generate SSEQ files happened
    http://sites.google.com/site/kiwids/ (see midi2sseq)
    More recently we got another one
    http://gbatemp.net/t301382-ds-code-sseq-player-and-new-mid-to-sseq-converter
    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://gbatemp.net/t305204-nintendo-ds-music-hacking-looping-included-fully-explained
    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://sites.google.com/site/kiwids
    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.

    VGMtrans
    http://gbatemp.net/threads/new-vgmtrans-github-and-loveemu.354869/
    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
    http://filetrip.net/f23649-CrystalTile2-2010-09-06.html

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

    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
    Code:
    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)
    0x00000430
    0x00031A30
    0x0005DC30
    0x0008C630
    0x000BE430
    0x000ED030
    0x000FFA30
    0x0012FA30
    0x00157430
    0x00188630
    0x001B7230
    0x001C9C30

    If you prefer a search for DSEQ
    0x00000400
    0x00031A00
    0x0005DC00
    0x0008C600
    0x000BE400
    0x000ED000
    0x000FFA00
    0x0012FA00
    0x00157400
    0x00188600
    0x001B7200
    0x001C9C00


    One tweaked header sample
    Code:
    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
    Code:
    00000004 00000000 ....
    00000008 00000000 ....
    0000000C 00000000 ....
    00000010 00000040 ...@
    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- https://ccrma.stanford.edu/courses/422/projects/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.

    ADX/AHX-
    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.
    adx2wav
    adh2wav
    wav2adx being the main tools here
    They can be found with a simple search but some downloads might appear at some point.
    http://www.geocities.co.jp/Playtown/2004/dcdev/dcdev.html

    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
    Code:
    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
    024D75E8

    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.



    Code:
    #
        #-------------------------------------------------------------------------------
        # 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)
         
        #-------------------------------------------------------------------------------
        #packerが第一引数からパック名・フォルダ名・ルートディレクトリ名を取り出すため
        #カレントディレクトリ名が入るように相対パスを指定
        #パス区切り文字として'\'しか受け付けないので注意
        all: makedir ge.pb
        ge.pb: $(SRCS)
        @$(PACKER) ..\\ge
        @mv ../ge.pb $(BINDIR)/sound.pb
        @mv ../ge.ph $(BINDIR)/sound.ph
         
        #-------------------------------------------------------------------------------
        makedir:
        @mkdir -p $(BINDIR)
         
        #-------------------------------------------------------------------------------
        install: all
        @cp $(BINDIR)/sound.p* $(INSTALLDIR)
         
        #-------------------------------------------------------------------------------
        clean:
        @-$(RM) -R $(BINDIR)
         
        #-------------------------------------------------------------------------------


    http://pastebin.com/uA6refYY

    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.
    Warning: Spoilers inside!

    BDX
    Seen in Daigasso Band brothers (and sequel)
    Another music game with a custom format, reverse engineered and tools made to support it
    http://www.auby.no/wiki/index.php?title=Band_Brothers_DX#Song_format
    http://dshack.wikia.com/wiki/Daigasso!_Band_Bros._series
    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.

    SDFDAT
    Seen in Super princess peach so far (another TOSE game causing fun).
    http://gbatemp.net/threads/vgmtrans-wont-work-with-super-princess-peach.357428/#post-4824844
    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.

    OGG/OGM
    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.

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


  2. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    960
    Location:
    toronto
    Country:
    Canada
    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

    Member loco365 GBAtemp Guru

    Joined:
    Sep 1, 2010
    Messages:
    5,459
    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

    Member andibad Soon™

    Joined:
    Sep 14, 2009
    Messages:
    699
    Location:
    hospital
    Country:
    Indonesia
    Pokemon Mystery dungeon explorer of dark/time/sky is SWD,SMD,SED format in sound folder... i can't open these format.
     
  5. Blazer

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    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

    Member andibad Soon™

    Joined:
    Sep 14, 2009
    Messages:
    699
    Location:
    hospital
    Country:
    Indonesia
    I just wondering about 3DS ROM audio format [​IMG] yeah waiting until 3DS ROM is cracked
     
  7. muguk

    Newcomer muguk Member

    Joined:
    Jun 16, 2010
    Messages:
    16
    Location:
    Warrington, Cheshire. UK
    Country:
    United Kingdom
    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

    SDF

    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

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,696
    Country:
    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.

    Code:
    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
    swdl
    Capitals of the filename
    wavi
    prgi
    kgrp
    pcmd
    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
    bnkl
    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)

    se_zo_ev_umbrella.sd

    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

    Newcomer muguk Member

    Joined:
    Jun 16, 2010
    Messages:
    16
    Location:
    Warrington, Cheshire. UK
    Country:
    United Kingdom
    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

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,696
    Country:
    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

    Newcomer muguk Member

    Joined:
    Jun 16, 2010
    Messages:
    16
    Location:
    Warrington, Cheshire. UK
    Country:
    United Kingdom
    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

    Member mrgone GBAtemp Advanced Fan

    Joined:
    Nov 6, 2002
    Messages:
    728
    Country:
    Germany
    wouldn't it be useful, if this would be stickied?
     
  13. muguk

    Newcomer muguk Member

    Joined:
    Jun 16, 2010
    Messages:
    16
    Location:
    Warrington, Cheshire. UK
    Country:
    United Kingdom
    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

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,696
    Country:
    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
    http://gbatemp.net/topic/253947-nintendo-sdat-specifications/page__view__findpost__p__3154732
    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.

    From
    http://web.archive.org/web/20100307024405/http://tahaxan.arcnor.com/index.php?option=com_content&view=article&id=44%3Asbnk-files&catid=29%3Anintendo-file-formats-sound-and-music&Itemid=36&lang=es


    '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
    0x0000002C
    0x0000002C
    1 byte0x02This is some sort of type. Doesn't know exactly what is for, but pointed data changes according with this number
    Data offset
    0x0000002D
    0x0000002F
    3 bytes
    0x00023C
    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

    Member Gericom GBAtemp Advanced Fan

    Joined:
    Jun 30, 2011
    Messages:
    583
    Country:
    Netherlands
    Mkds course modifier can play sseq with sbnk. It can also convert sseq to midi and sbnk to dls.
     
  16. loco365

    Member loco365 GBAtemp Guru

    Joined:
    Sep 1, 2010
    Messages:
    5,459
    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

    Member Gericom GBAtemp Advanced Fan

    Joined:
    Jun 30, 2011
    Messages:
    583
    Country:
    Netherlands
    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

    Member loco365 GBAtemp Guru

    Joined:
    Sep 1, 2010
    Messages:
    5,459
    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

    Member Gericom GBAtemp Advanced Fan

    Joined:
    Jun 30, 2011
    Messages:
    583
    Country:
    Netherlands
    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

    Member loco365 GBAtemp Guru

    Joined:
    Sep 1, 2010
    Messages:
    5,459
    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?
     

Share This Page