Skip to content

Instruments and sound banks

A sound bank is a folder in audio/bank/, such as audio/bank/SYS2/, that holds up to 16 instruments. Each instrument is a mono WAV sample plus its tuning, an optional loop, and an envelope that shapes its volume. The bank's sound_bank.xml file lists its instruments and envelopes. Sound effects, ambient sounds, and songs play samples through the instruments in banks.

New > Sound Effect adds its sample to one of your mod's sound effect banks, SFX1 to SFX9, and creates the bank if it needs to. See Add a sound effect. You only make a bank by hand for instruments that songs play.

Editing an instrument

Open a sample's WAV file in a bank's folder to edit it in the Sound editor. For a sample that loops, opening either of its WAV files shows the whole sample.

  • Root note and the cents next to it are the pitch at which the sample plays unchanged. A one-shot sound effect plays note C3, so in a one-shot, a sample with a root note of C3 plays at its recorded pitch.
  • Envelope chooses one of the bank's envelopes, which shape the volume while a note is held and after it's released.
  • Loop is off, forever, or a number of times. See Loop a sample.
  • Select Play, or a key on the on-screen keyboard, to hear the instrument.

To change part of the sample, select it on the waveform and right-click the selection. The menu has Crop to Selection, Fade In, Fade Out, Normalize, Louder (+3 dB), and Quieter (−3 dB). If the sample's rate is higher than 32 kHz, the rate the game plays sound at, select Convert to 32 kHz.

To replace a sample, drag a WAV file with the same name from your file manager onto the bank's folder in the Filesystem. The file must be mono, 16-bit PCM.

Loop a sample

  1. Open the sample in the Sound editor.
  2. Set Loop to forever, or to a number of times and enter how many times the loop plays.
  3. Drag the loop marker to where the loop starts, or select the part of the waveform to loop from, right-click it, and select Loop From Here. The loop runs from there to the end of the sample.

In the bank's folder, a looping instrument has two WAV files: one for the part before the loop and one for the loop. The instrument's loop attribute in sound_bank.xml names the loop's file. The Sound editor names a new loop's file after the sample, such as hum_loop.wav for hum.wav.

Adding an instrument for songs

A song can play instruments from banks that it loads, so its samples don't have to be in a bank that's always loaded. Give these samples a bank of their own. Don't add them to an SFX bank, because a bank that a song loads isn't always loaded, and sound effects can't play from it.

  1. In the Filesystem, right-click audio/bank and select New > Folder. Name the folder after the bank, with four characters at most, such as MUS1.

  2. Drag your WAV file from your file manager onto the folder. The file must be mono, 16-bit PCM, and named in snake case, such as chime.wav. No other bank can have a sample with the same name.

  3. Copy sound_bank.xml from another bank, paste it into your folder, and replace its contents with this:

    <?xml version="1.0" encoding="UTF-8"?>
    <SoundBank>
        <Instruments>
            <Instrument wav="chime" envName="env1" keyBase="4800"/>
        </Instruments>
        <Envelopes>
            <Envelope envName="env1">
                <Commands>
                    <Press>
                        <Point duration="0" volume="7F"/>
                        <End/>
                    </Press>
                    <Release>
                        <Point duration="120ms" volume="00"/>
                        <End/>
                    </Release>
                </Commands>
            </Envelope>
        </Envelopes>
    </SoundBank>
  4. Open chime.wav and set its root note and loop in the Sound editor.

  5. Select Game > Play, so that the Song Editor lists the new instrument. Then choose it for your song.

To add more samples to the bank, add an Instrument element for each one at the end of Instruments. Songs refer to an instrument by its bank and its position in the bank, not by its name, so don't reorder or remove instruments that a song uses.

Adding an envelope

The Sound editor's Envelope list shows the envelopes in the bank's sound_bank.xml. To add one, add an Envelope element to Envelopes with a new envName. env1 in the example above holds the volume at full (7F) while a note is held, and fades it to silence in 120 milliseconds after the note is released. The game's banks, such as audio/bank/SYS2/sound_bank.xml, have more envelopes to copy.

Limits

  • A bank holds 16 instruments at most.
  • A sample name can appear in only one bank.
  • The game loads at most 79 always-loaded banks.
  • A bank that a song loads can hold fewer instruments and envelopes than an always-loaded bank.
  • Your audio must fit in the space the game can address. If it doesn't, use shorter samples or lower sample rates.