Nintendo DS Music Hacking- from Extraction to Insertion

Discussion in 'NDS - Tutorials' started by loco365, May 3, 2011.

Thread Status:
Not open for further replies.
  1. loco365
    OP

    Member loco365 GBAtemp Guru

    Joined:
    Sep 1, 2010
    Messages:
    5,459
    <!--fonto:Arial Black--><span style="font-family:Arial Black"><!--/fonto--><!--sizeo:6--><span style="font-size:24pt;line-height:100%"><!--/sizeo--><!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->THIS IS A WIP. I NEED TO MAKE MANY MORE EDITS BEFORE THIS WILL BE ENTERED.<!--colorc--></span><!--/colorc--><!--sizec--></span><!--/sizec--><!--fontc--></span><!--/fontc-->

    The Nintendo DS's file-based system can be modified with ease if it is understood. This tutorial, although well, or mostly well re-worded, will attempt to explain music hacking, even if you are new to NDS hacking.

    <b><!--sizeo:5--><span style="font-size:18pt;line-height:100%"><!--/sizeo-->Part One- Accessing The Song You Wish To Modify<!--sizec--></span><!--/sizec--></b>
    To do this, you will need VGMTrans. You can find a good version of it in the Hack Pack at the end of this tutorial, and on FileTrip later on. Do note that the program is unstable and may crash. It will not damage your computer whatsoever, though. Just restart the program and try again. A Google search may find you other builds and copies of this program.

    <u>Getting the MIDI and DLS files</u>
    This is the main focus of this tutorial. Without these files, it is completely pointless to do this tutorial.

    What is a MIDI File?
    A <a href="http://en.wikipedia.org/wiki/Musical_Instrument_Digital_Interface" target="_blank">MIDI</a> file is a type of sequenced audio. Many systems use sequenced audio, and can easily be converted to and from MIDI, like Nintendo DS Sound Sequence (.sseq) files.

    What is a DLS file?
    A DLS file contains audio samples that play to certain instrument patches that MIDI players can interpret. You will need these files to do this, because it will save a lot of time later on.

    Anyways, to get these files, there are two methods, but I will give you the easiest method, because it will save you lots of time later on. First of all, open CrystalTile (included in the Hack Pack!) and open the NDS image of your choice. Once you open it, at the top of the screen, click the logo of the DS that is there. It will pop open another screen. Look for a .sdat file.

    What is a .SDAT file?
    .SDAT means sound data. Nintendo DS games use these files to store sound information that is used in the game.

    Once you find the sound data (.sdat) file, right-click on it and export it to a location on your computer. You can now close the program, it will not be needed for a while. But, you will need VGMTrans, so open it. Keep in mind that the Open function from Menu will not work, so in Windows Explorer, browse to the .sdat and click and drag it to the program. It may take some time to open the file, so be patient. Once the audio files are opened, you can find the song that you wish to edit. Once you do, Right-click on it and select "Export as MIDI and DLS". If you do not have this option, on the bottom left side, you can export MIDI and DLS from those files as well. You can now close VGMTrans. I will now explain what you will be doing with these files.

    <b><!--sizeo:5--><span style="font-size:18pt;line-height:100%"><!--/sizeo-->Part Two- Modifying Music- and knowing what it will sound like<!--sizec--></span><!--/sizec--></b>
    <u>FL Studio</u>
    In order to follow through with this tutorial, you must have the program FL Studio. There is a link to the program in the Readme in the Hack Pack. It will install FL Studio, and ASIO4ALL. It is a MIDI Driver, but is optional, but recommended.

    <u>FL Studio- Importing and Editing music</u>
    Here is the easiest part. All you need is imagination! Double-click on the FL Studio icon and launch the program. Note, that if you are using the Demo, you cannot save as a project (.flp.)

    NOTE: If you export it as a MIDI, you can work around this restriction. It is easier, though, to have a full version.

    Go File- Open, or click and drag the MIDI onto the program. A window will pop up with the numbers 1-16. Don't modify anything on it, just press OK. You have the MIDI open. But, there are two problems. How will you know what it sounds like? And how can a loop be simulated? This is very easy.

    When you open a MIDI in the program, a secondary window will open, on the bottom-middle, it will say FRUITY LSD. No, it's not a drug. This is what will handle your .DLS file. Before you touch Fruity LSD, press Play (spacebar). It sounds very... Awkward. Stop it, and click the little folder on the Fruity LSD window and browse to your .DLS file.
    <img src="http://pix.gbatemp.net/261213/Fruity%20LSD.JPG" border="0" class="linked-image" />
    Now, press play again, and it will sound correct! Note, though, that not all 126 MIDI instruments are used at once. Some games use just one patch, while some can use more than 70. It depends on the game.
    <!--fonto:Impact--><span style="font-family:Impact"><!--/fonto--><!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro--><!--sizeo:6--><span style="font-size:24pt;line-height:100%"><!--/sizeo-->--------EDIT LINE--------<!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc--><!--fontc--></span><!--/fontc--> I will continue to edit this later on. I have done this much, and there is more to add, including more content that only GBAtemp will have! Stay tuned!
    <u>FL Studio- Exporting the final product</u>
    Now, you've finished, eh? Click on File and go to Save As... . Now, save as the type .midi and name it. When it's done, you can close FL Studio. You've exported it, and it's almost ready to be inserted!

    <b><!--sizeo:5--><span style="font-size:18pt;line-height:100%"><!--/sizeo-->Part Three- Inserting the song<!--sizec--></span><!--/sizec--></b>
    In this part, you must pay attention. The most crucial steps are in here, and if you screw up, the song WILL NOT play correctly.

    <u>Just a minor adjustment here...</u>
    This, along with other steps, is a crucial step to getting this to work. Once the MIDI is exported, open it in HxD and look for the 0x0D byte. It should read, "60". Change it to "C0" and save. Re-open it in FL Studio and listen to it. It should be about 2 times faster. DO NOT ADJUST THE TEMPO! Instead, export it, again, as a MIDI, and you can overwrite the old one, you won't need it. Once it has done so, open your new MIDI in HxD. Change the 0x0D byte from "60" to "30". Open it in Windows Media player, and it should sound normal.

    <u>Converting</u>
    The program midi2sseq, included in the Hack Pack is a blessing and a cursing. It converts the song via drag-and-drop, but the program is not perfect. There is another post on here (<a href="http://www.pokecommunity.com/showpost.php?p=6263943&postcount=7" target="_blank">http://www.pokecommunity.com/showpost.php?...amp;postcount=7</a>) that points out that the program does not code the tracks correctly. But, you can use HxD, a freeware hex editor to repair that. After converting, click and drag the new .sseq on to HxD. Now, go to Search and click on replace, or press Ctrl+R. Before doing anything, click on the drop-down beside Datatype and select Hex-values. Now, in the field Search For, put FF C0. After, in the Replace With menu, put FF C7. Run the search. Now, when it comes across one, it will replave it. After each replacement to FF C7, overwrite the next two bytes with 00. Once there are no more FF C0 bytes to be found, save the file. You have repaired the file.

    <u>Inserting</u>
    You're nearly done. Just a little more to do! Keep HxD open and drag your .sdat to the window as well. It will open it in a new tab. Go to the .sseq tab and select all of it and copy it. Keep in mind that files CANNOT BE REPOINTED! I pointed this out because if you look at the bottom of the HxD window, there is a portion that says "Length: XXXX." Write that number, or memorize it, or something. Now, open VGMTrans and open the .sdat you took the original song out of. When it opens the song that you wanted to edit, in the bottom left-hand corner, there will be 3-4 icons. The one on the top, that has the icon of some sheet music, double-click on it. It will open a colorful display in the largest part of the window. It resembles a Hex Editor, but you can't do anything to it. Without touching the scroll, on the left side of that light show, there are Hex Addresses. Keep in mind the top one. That is the address that is hardcoded in the game as the place to access that track. Now, in HxD, go to the address and look at the side. It should have SSEQ in the side. Now, click and select to the next SSEQ in the side. Once you get there, look at the Length. If it is larger than the .sseq, you will have to edit it or remove a track until it is smaller or equal to that number. Now, return to the address that VGMTrans gave you, and do an PASTE. WRITE.You can also press Ctrl+B. Now, save. Open the .sdat in VGMTrans and access the song you inserted and test it. If it sounds correct, you can continue to the next part! Open CrystalTile and open the DS Rom image. Now, browse to the .SDAT file in the file browser, and right-click on it. Click Import File and browse to the .sdat file on your hard drive. Give it a minute, and it will insert it. If it doesn't save, save it. Now, test it in a DS Emulator or on a Flash card!

    Now, you may notice it doesn't loop. That is because I haven't found out how yet. If I can find out how to do this, I will update this tutorial to tell you how. <b><!--coloro:Red--><span style="color:Red"><!--/coloro-->NOTE THAT ANYTHING RELATED TO A FL STUDIO PLUGIN NAMES MAGICSSEQ IS 100% FAKE AND <u><i>WILL NOT</i></u> WORK!<!--colorc--></span><!--/colorc--></b> If you have followed all the steps correctly, you can make some good music. Like my song, for instance:
    [youtube]g61TjA__y9g[/youtube]

    Hack Pack link: <a href="http://www.box.net/files/0/f/0/1/f_581072414" target="_blank">http://www.box.net/files/0/f/0/1/f_581072414</a> and <a href="http://www.megaupload.com/?d=65A88ARG" target="_blank">http://www.megaupload.com/?d=65A88ARG</a>
    If this worked for you, then good job. If not, keep reading. If something is unclear, don't hesitate to ask! I thank you for your time.
     
  2. KingdomBlade

    Member KingdomBlade Blade v3+ (I R SHMEXY)

    Joined:
    Apr 24, 2009
    Messages:
    2,941
    Location:
    In Vulpes' Fur
    Country:
    Philippines
  3. Nathan Drake

    Member Nathan Drake Obligations fulfilled, now I depart.

    Joined:
    Jan 2, 2011
    Messages:
    6,192
    Country:
    Antarctica
    From the looks of things, you basically just copy pasta'd your tutorial over changing the wording ever so slightly. I'm pretty sure that won't make the cut.
     
  4. SamAsh07

    Member SamAsh07 GBAtemp Addict

    Joined:
    Jan 27, 2009
    Messages:
    2,693
    Location:
    Bahrain
    Country:
    Bahrain
    I thought this was original...looked so nice.
     
  5. Depravo

    Global Moderator Depravo Jaded curmudgeon

    Joined:
    Oct 13, 2008
    Messages:
    5,074
    Location:
    Purgatory
    Country:
    United Kingdom
     
Thread Status:
Not open for further replies.

Share This Page