Thread: [Tutorial] GoGo's MEGA-HUGE SAPPY TUTORIAL
View Single Post
  #1    
Old May 3rd, 2013 (05:14 PM). Edited May 22nd, 2014 by GoGoJJTech.
GoGoJJTech's Avatar
GoGoJJTech
http://GoGoJJTech.com (WIP!)
Community Supporter
 
Join Date: Nov 2012
Location: Earth
Age: 16
Gender: Male
Nature: Quiet
Hello, I'm gogojjtech and I'm here to make this tut on behalf of the community. Before we get started, I would like to ask you to download the TUT_FILES.rar right now, so you can understand as I go along.

There are two video tutorials on this, so if you'd like to watch them then here they are:






Things You'll need:
FSF or Advance Map's FSF
A Hex Editor
Sappy12.exe
Sappy.Xml
Sappy Mod 17.1
Mid2Agb.exe
MidFixforAGB.exe
MIDI FILE (My collection is in TUT_FILES.rar )
Anvil Studio
Wavosaur
Your Mind (you need this)

LET'S GET STARTED!!!
First

Open up Anvil Studio. In this tut, I might say A.S. but I just mean Anvil Studio. Get your MIDI file open.
Spoiler:

For this Tut, I will be using the HGSS version of the Kanto Gym Leader Battle, because it was the last song for me to do to complete my PWT script
Now, all the experienced people around here know the games only read the first 10 tracks and 5 directsound tracks! People who don't know, the games read the instruments and cries as directsound, basically like your music. To get around the Directsound issue, follow this by Jambo51. LINK
For the track amount, I will explain a little later. Be patient

So you have your song, now you want to loop it! follow this to loop by Team Fail LINK
So you got that? Good (I hope)
If you already have Sappy working skip to 3

Second
For many of you on here including myself, Sappy requires a specific file by the name of VbalCboEX6.ocx to run. You will not find this on the internet (as of now) but I provide the solution. Download the sappy12.exe file from the beginning of this tut and open it. It will install the necessary components to run sappy. Once it's done... DELETE EVERYTHING EXCEPT THE MID2AGB FOLDER!!! Because that Sappy is old, I have the newest one (again at the top) for you to download. Move the new Sappy.exe you downloaded to the existing folder and the Sappy.Xml I provided. Now you have a WORKING sappy

Third
Now that Sappy is open, open your ROM. I will be using FR.
Spoiler:

You will want to click that little arrow from the pic for your own benefit. BUT WAIT!!! You need to assemble your song. Drag your MIDI file you looped ONTO mid2agb.exe and a popup will appear, then disappear. In the same folder, you should have two files now.
Spoiler:

In sappy, click the assemble song button. You should get this:
Spoiler:

Let me explain:
1. The offset you will place the data at. In FSF you should search for 10,000 bytes of free space just to be safe.
2. The voicegroup offset, where the pointers to instruments are located.
Open your song and press Cook it! Then wait for it to finish. Popup!
Spoiler:

Just click yes. Just...do it.
Now you have this or something similar:
Spoiler:

Try to play it in VBA. It sounds 8-bit, right? Well that's why this tut exists, to teach you how to make amazing music.

Fourth
I will explain it all.
Spoiler:

Ok, one by one.
Yellow Underline: This is the location of the track in the ROM.
Red Underline: Instrument number. Add one to it to see its number in A.S.
Green Underline: The force of the instrument. Usually this is not constant, but the more force the higher volume.
Light Blue Underline: It remains 100 in all tracks for fanfares and in the rest it ranges from 0-127 and changes. Ipatix says it's the actual track volume. More info here: http://www.pokecommunity.com/showpos...19&postcount=9
Dark Blue Underline: The "tuning" as I call it. Play Deoxys' theme and watch the squares, they change pitch. Also the cave themes do this.
Purple Underlines: Types of instruments. There are 7. Directsound, Multi, Drums, Wave, Square1, Square2, and Noise. Squares are beeps. You CANNOT have two of the same type of Wave, Square1, Square2, or Noise playing at the same time. Directsound, multi, and drums can be played together as long as you don't pass the limit. That's why I had you extend them earlier. Sappy keeps the limit 5, but in VBA you will hear them all.
Blue Circle: The top says Table, and this is the location of the pointer to the header. The header tells the game where the tracks are and what voicegroup to use. The voicegroup tells the game where to find the instruments.
Green Bars: The actual sound. If it's on the left, it comes out of the left speaker, and vice versa. In the middle means both speakers play it.

Now to make your song sound normal. Play your song and wherever it says square1 or square2 you need to change its pointer. I have instrument 23 (24 in A.S., or Tango Accordian). Click Edit Voice Table. Go to your instrument.
Spoiler:

You must be wondering what to do at this point. Change it to Directsound if you want it as a normal instrument (preferred). If your instrument has many different pitches, you need to choose multi. Let me do one thing at a time.
Atk: Attack - Attack determines the time it takes for the note to get to the maximum level.
Dec: Decay - Decay determines the time it takes for the note to go from the maximum level to the sustain level (controlled by Sustain).
Sus: Sustain - Sustain determines level the sound is played at while the note is held (after the other envelope states, Attack and Decay, have been completed).
Rel: Release - Release determines the time it takes for the note to fall from the sustain level to zero (silence) level when it is released.

Get it? The best results are 255 0 255 165, but that is from experience, so play around with it, or comment on what you like to use. Leave everything else because it distorts your instrument.

When you choose multi, you get prompted for an address 1 and address 2. The first is a pointer to your custom voicegroup.
DO NOT MISTAKE THIS AS YOUR INSTRUMENT.
The second is a pointer to your "MIDI Keyboard". This looks like:
Spoiler:

I will explain. This is loaded with the voicegroup you point to. In my picture, It says 0 - 0x10fea60
So instrument 0 in the custom voicegroup will be played. Every note highlighted in green will play this instrument. If you turn to 1, and high lite some notes, whenever those notes are played in the song, instrument 1 will be used, not 0. Using a multi instrument in your multi instrument freezes the game.
Drums are a bit different, but more confusing. It uses a custom voicegroup like the multi, but does not use the MIDI Keyboard. Here's what ipatix told me:

Quote:
Originally Posted by ipatix
The drum table works exactly like a regular voicetable but instead of using different instruments by different program changes of the song data they use different instrument depending on the MIDI key played.
The instrument definitions work all the same but know the "0x3C" byte (the second byte) is used in this case and defines at which MIDI-key-pitch the sppecified drum should be played at.

So in regular tables this value isn't used but seems to always be "0x3C" or "0x00" for some reason
Fifth
Ok, here's when we import our instruments we want into the game. You should have a sample of the instrument from anywhere. Open it in Wavosaur.
Spoiler:

You need to make a modification to it before inserting. Go to process -> Bit Depth Converter.
Spoiler:

Do everything I did. It should sound good in the GBA if you have it set to 8-bit, because the natural sound the GBA produces is 8-bit
Save.
Now in Sappy go to Import Sample.
Spoiler:

Open the .wav you have now.
Import Address: The offset to import. Remember to change it in the Voicegroup as well.
Change Frequency: Changes how long or short the instrument is. It also makes it higher pitched or lower pitched. More info: http://www.pokecommunity.com/showpos...19&postcount=9
Enable Loop: Where the instrument loops. Try putting this around a half so if you have a long note, the instrument doesn't just end. It loops.

Once you are done you have your instrument!
Do this until you have no more squares.

Sixth
Play it in VBA. If you hear crackling, It's because your song is TOO LOUD.
There are two ways to fix this:
1. Open the MIDI in A.S. and lower the track volumes.
2. Thanks to Team Fail, I now know that there is another way to do this.
Quote:
Originally Posted by Team Fail
Open your .S file in a text editor, and look for the following line:
Code:
	.equ	name_of_s_file_mvl, 128
Change the 128 to something lower, this line controls the overall volume of a .S file. You can adjust this and change the volume without having to convert your song over and over again.
Now to extend the amount of playable tracks!!!
Open your ROM in a hex editor.
Go to the Songtable (check Sappy.Xml to find your songtable in your version)
Right before the songtable in the ROM there are a few RAM pointers. Look for the pointer that is right before the string "0x0A 0x00 0x00 0x00". The 0x0A byte is the amount of tracks the game will read. The max is 16 tracks (10 in hex). I put 0x10 0x00 0x00 0x00. BUT YOU NEED TO CHANGE THE POINTER DIRECTLY IN FRONT OF THIS STRING!!! Just leaving it causes the game to use the INCORRECT DATA. Make sure that your pointer right before the 0x0A has enough space in the RAM for your Y-Tracks * 0x50. So for 16 tracks you'd need 0x320 bytes at your new RAM area. You should use the RAM at 0x03004308, as it has so much space. In FR US v1.0 the RAM pointer is located at 0x084a32a0. Change it and you are good to go!
The result is in TUT_FILES.rar called KantoGym.gba.wav
(I faded it out with Wavosaur )

Getting Sounds From a DS ROM
Ok, so I admit. Kantogym.wav wasn't exactly perfect material. But that's because I used non-DS sounds. Here I will teach you exactly how you can get those sounds, or those MIDIs that you want.
Get this tool called VGMTrans. LINK
This tool lets you extract sounds and songs straight from your DS ROMs. Problem is, Mystery Dungeon ROMs don't work on any DS sound extracting tool around.
So here's where people get confused. You open VGMtrans manually, and drag your ROM INTO the program where the gray box is.
So while that loads, keep in mind that it crashes very often. So do what you need to do and do it fast. So first, you find your song. You can even play it with the play button on top. Once you found what you're looking for, you export it.
Spoiler:

That Cyan arrow shows what song I'm using. The pink shows the song's MIDI. Right-Click to export. Save wherever. Now that dark blue arrow contains the "SoundBank". This is basically a DS voicegroup. Save wherever. Ok, so you have your DLS and MIDI. So as normal, loop the MIDI and convert to .S, lower volume if you need to, WHATEVER. Import into Sappy, and BAM! It's in. Now for the sounds!
Download this tool called "Viena", it opens the soundbank. LINK
Open your soundbank .DLS file.
Spoiler:

That green line shows the instruments with their corresponding numbers. Double-clicking them will take you to the info screen.
Spoiler:

The red arrow contains the samples. In this case, there are multiple samples. You know what that is, it's a multi instrument!
The pink has the instrument data. 0-42 shows that keys 0-42 will play this instrument. sample loop = 1, which means that it does loop. otherwise, no. Root Key = 40. This is used to determine that stubborn frequency.
Here's an example of a single instrument, our "directsound".
Spoiler:

Cyan shows you only one instrument. The blue again, contains it's data. 0-127 obviously shows that it's used all the time. It loops, and the Root Key is 79.
I know what you're thinking. How exactly do we know the loop point? Well...
Spoiler:

Right there, you have your loop point. However, I should point out that HG/SS have incorrect loop points, so you need to look at the wave itself and determine. You can do that by double-clicking the instrument on the left.
To find frequency, you need a tool made by Ipatix. LINK
That Root Key is crucial in finding your frequency. So you get your instrument's samplingrate from either Sappy or Viena. Double click the instrument to know what I mean.
Spoiler:

The green is the sampling rate. The red is always incorrect, you found this earlier. The blue exports your wav so you can import it into Sappy later.
So input your info in the frequency calculator:
Spoiler:

For Fine tuning, all Pokemon games so far have 0 for each instrument. When copying your result, just keep the first 3 numbers after your decimal point. No need for anything else, since Sappy just reads the first 3.
Spoiler:

Also, if your Root Key isn't shown in Viena, it's 60, and 60 requires no change at all to your frequency. So if it's 60, don't bother putting it through the calculator.

So you import to Sappy.
Spoiler:

That's for single instruments. Then you edit your voicetable and Change to directsound, then follow like earlier.
For multi instruments, look closely.
Spoiler:

The left is the one being viewed. Top right shows which pieces of the multi's keyboard use this instrument. 0-48. This one loops and has a sampling rate of 41. The loop is 4264.
So import, blah blah blah. So now you want to make it a multi, it's keyboard needs to know which is which. The 0-48 is used now.
Spoiler:

I'm using this area. 0-48 is actually 49 numbers. So I usually just add one to the amount it says. So you select 49 bytes:
Spoiler:

And you fill with 00, since the first instrument is actually 0.
Spoiler:

So for instrument 01, it's 49-127. So that's 79 bytes.
Spoiler:

And fill with 01 this time:
Spoiler:

That's part2 of the multi, where it's a MIDI keyboard. Now you create a small voicegroup for it to load. Oh, you should be keeping a log of where everything is.
Spoiler:

Now you make the Multi. Sappy -> Edit Voicetable -> (instrument number) -> Multi Instrument
Spoiler:

Edit address1 to the way you would set up a normal voicegroup, just in the order Viena gives you. So Instrument 0 goes at slot 0, 1 at 1, so on. Same with Drums, just put them where Viena lists them. Edit to your liking:
Spoiler:

And Save. Continue to do those steps to make it sound good. Also, if in Viena you click your instrument and it only says "global" but contains no instrument, it could be either square1, square2, or wave. Your choice!
Well, that covers just about everything...


You can make sappy play more than 5 tracks at a time.
Click Options -> Settings -> Extra
Directsound voices limit = 5
Change to 12 since the extension supports 12 (or 7 for RS)
You can change other stuff too but whatevs.


Credits
ipatix - Track extension, teaching me about the drums and multi instruments
Jambo51 - Directsound extension
gogojjtech(me) - For teaching myself about a third of the stuff on here
Team Fail - His Tut on how to loop and for the alternate lower volume trick

Ok, I hope you have been helped, if you have any questions VM or PM me. Good Day. PEACE
__________________
Reply With Quote