Archive Generated December 23rd, 2018
Porting Music From One DS Game To Another
Author Posted on 2018/02/18
Yoshimaster This tutorial goes very into detail, in case there is confusion. You may already know some of this information, but I will explain it anyway just in case.

Tools that you need:
DS Sound Studio (DSSS)
Nitro Studio (NS)
Polyphone or Viena (and any soundfont (.sf2, .dls, etc.))
Any hex editor (HxD, CrystalTile2, etc.)
Anvil Studio (or any other midi editing software)
EveryFileExplorer (EFE)

Step 1: Open the SDAT that you are extracting music from with DS Sound Studio. Find the SSEQ that you want to port, and take note of the SSEQ name, the bank (SBNK) ID, and the SWARs that the bank uses. Don't close DSSS, you'll need it later.

Step 2: Open the SDAT in kiwi.ds. Double click it to open the file explorer. Locate the SSEQ that you want to extract, and right click it > convert to midi (you'll see why later), and also right click > extract. Locate the SBNK file that you need, and right click > extract. Locate the SWARs that you need, and right click > extract SWAV for each of them. The files will appear in the same folder as your SDAT.

Step 3: Since some SWARs are shared by multiple songs, you'll need to know which SWAVs your song uses. Go back to DSSS and double click the SBNK in the Sound Bank folder that your SSEQ uses. Also, open Nitro Studio and open the SDAT. In Nitro Studio, locate each SWAR (under "Wave", and double click to open them) and listen to each instrument. Switch back and forth between NS and DSSS, listening to the instruments, and decide whether or not the SBNK uses each instrument that you hear in NS. If you hear an instrument in NS that's not in DSSS, you can delete it from the SWAVs that you've extracted. Also, you should rename the SWAV files to their instrument names (at least a name that you can remember what the sound is) and pitches (to find pitches, see below ***), so that you don't get confused later.

*** To find pitches of instruments, open Polyphone or Viena and open any soundfont (preferably one with instruments at their correct pitches, as some soundfonts do not use correct pitches). On the left under "Presets", click any instrument (except for drums), and click on the piano until you hear the pitch that is the same as the SWAV that you've extracted. It will tell you the key number of the pitch (to the left of the piano in Polyphone ("Key XX"), or underneath the piano in Viena ("")). Use the key numbers in the file names of your SWAVs.

Step 4: You will need to count the total number of kilobytes that all your SWAV files take up. If the total is more than about 30 KB (approximately the maximum that MKDS uses in most SWARs, as far as I can tell), you will need to replace some SWAVs in the game's common SWAR file, if the game has one (ex: SWAR 80 in MKDS, which most of the game's songs use). This will save on memory. If the game has too many SWAVs loaded at once, the game's audio will mute. If you need to replace SWAVs in the game's common SWAR file, continue to step 5. If not, skip to step 7.

Step 5: Open kiwi.ds and the SDAT that you will be porting the music to. Locate the game's common SWAR (SWAR 80 in MKDS) and right click > extract SWAV. Go back to Nitro Studio and open the SDAT you'll be porting music to and the common SWAR. Listen to the instruments, and find some that you think you can replace with instruments that you've extracted. Try to replace drums and other percussion first, so that you don't have to edit other SBNKs. (For example, if you replace one Piano with another, and they both have different pitches, you will also need to edit all the SBNKs that use the Piano, so that the other songs don't have off pitch notes in game). Go into the folder of the common SWAVs, copy the name of the SWAV you want to replace and then delete it. Copy your SWAV into the folder and rename it to the same name as the old SWAV.

Step 6: Open SWAV2SWAR and drag all the SWAVs in the common SWAR onto the window. If you renamed the SWAVs that you replaced correctly, they should all be in the correct order. Click create SWAR, close SWAV2SWAR and continue with step 7.

Step 7: Open SWAV2SWAR and drag your extracted SWAV files (for the completely custom SWAR) onto the window. Try to keep each instrument together (ex: if there are 2 Piano SWAVs of the same Piano at 2 different pitches, keep those together in SWAV2SWAR to make it easier when editing the SBNK). You can either drag each instrument in one at a time or use the arrows on the right side to move instruments around. Make a note of the ID of each instrument, then create the SWAR.

Step 8: Open the SBNK file you've extracted with HxD. You will need to change each instrument so that it matches up with the SWAR that you've created. This is where you will need the notes that you made for the instrument IDs, as well as the pitches. The pitches and instrument IDs you've noted down are in decimal, so they will have to be converted to hexadecimal. For more detail on how to edit SBNKs, you can view Kitty Ambiance's tutorial here: https://www.dshack.org/forum.php?page=thread&tid=363.

Step 9: Go back to DSSS and close the SDAT that you extracted files from. Open the SDAT that you want to port the music to, and replace the SSEQ, SBNK, and SWAR (make sure to replace the SBNK and SWARs that match up with the SSEQ that you want to replace). Then, open the Sound Bank folder and click once on the SBNK that you replaced. The values on the right under "Wave Archives" should be the same as the SWAR(s) that you just replaced. If you only used and replaced one SWAR but there is more than one value, change the other values to "65535" so the game doesn't load more than what is needed. Also, the SWAR IDs need to be consistent with what's in the SBNK (so if you used your custom SWAR as ID 0 when editing the SBNK, then Wave Archive ID 0 should have the same as your SWAR's ID).

Step 10: Go back to the Sequence folder in DSSS and double click the one you replaced. If you did everything correctly, you should hear the song play exactly as it did in the SDAT it was extracted from. Don't forget to save!

Step 11: Open your ROM in EFE, locate the SDAT, replace it with the new SDAT, and save the ROM. Load your ROM and enjoy!

Let me know if anything doesn't make sense, it's my first time making a tutorial.
Also, I'll probably add images later, so stay tuned.