Exporting Samples from SoundFonts with Viena
Next up download and install Viena SoundFont Editor. It’s freeware, but you should consider donating because it’s fantastic software. Open the .sf2 in Viena SoundFont editor.
You’ll be presented with this screen, or something very similar to it.
You need to find the sample you want to rip, which may require some guesswork. You can click on the keys to play notes using that sample.
Now you need to expand the instrument info so you can get to the sample.
Expanding it will give you a list of the samples used within the instrument, which could be anywhere between 1 - 127. If
You’ll see some extra info displayed about each sample, including:
- which note(s) (the range) it’s set to play for - useful for drum and multi instruments
Pan (in %, where 0 is middle, -50% is left and 50% is right. For reference, in decimal, middle Pan is 64, left is 0 and right is 127)
- the root key (IMPORTANT!)
Right click on where it says “Sample 132” (blue box) and it’ll bring you to this window. This is from a different sample which I’ve picked to show you some more information.
This window gives you information about:
- the size
- the loop point (ALSO IMPORTANT!)
sampling rate (ALSO ALSO IMPORTANT)
root key (again)
You need to write down the loop point and root key somewhere, as well as the rate. Hit Export WAV file and save it as something easily identifiable. I like to include the loop point, root key and sampling rate in the file name for easy reference.
Converting the Sample to 8-bit Depth
If you’re ripping the samples from non-FE sources, the sounds may possibly be in 16-bit WAV and not 8-bit WAV, which is what the GBA natively plays. You can keep them as 16-bit WAVs and insert them later but this will cause ugly sound glitches. To convert them you’ll need the help of Wavosaur.
Open your sample in Wavosaur.
Process -> Bit Depth Converter -> 8-bit -> OK. Hit Save/Ctrl+S.
It’s been converted to 8-bit!
Obtaining the Frequency Adjustment Value
Before we import the sample into the game, we need to know whether or not the sampling rate needs to be adjusted to be played properly in-game. If you miss this step you may find that your sample plays at the wrong pitch, which may not be pleasant. Or it might be really pleasant, depending on what the interval is :P:
Anyway, download this Frequency Calculator by ipatix of PokeCommunity. Open it, and enter the details that I asked you to write down earlier. Those were:
- sampling rate
- and root key
The calculator will ask you for a third value, Fine tuning, but we’re not using that, so just input “0”
You’ll get a number back, which you should record to the 3rd decimal. Keep note of this.
Importing the Sample using Sappy
This should feel familiar to you if you imported a sample from another game. Open up Sappy, hit “Import Sample”, find the WAV. This time things are a little different.
The “Change Freq.” box isn’t greyed out, and neither is Enable Loop. You need to put those in yourself. “Change Freq” should be to whatever number the calculator gave you. If you don’t need to change anything, don’t tick it. If your sample is looped, tick the box and input the loop point you got from Viena earlier on.
Hit Import. You’ve inserted your sample. Once again, ensure your voice table is updated to include a pointer to this sample. Now you can play your sample in your FE game.
As for the envelope, this is something you’ll need to decide on your own based on intuition. If your sample is non-looped, 255 0 255 204 is a good setting. If it’s looped and doesn’t deteriorate (.e.g strings, trumpet) then 255 0 255 204 is also good. If it’s looped but does deteriorate (e.g. piano, harp, tubular bells) then a good setting to use might be 255 242 128 204. Experiment a little.
If you’re ripping a multi-instrument you’ll have to include an extra step in which you not only import all the samples but also import the note ranges from Viena. This should be easy enough given what I’ve shown you in earlier tutorials.
And now you know how to insert custom samples. Good job for making it this far!