Music Directory - pk-hack/CoilSnake GitHub Wiki

With the release of Coilsnake 4.2, the new Music directory was added. Here is how you can use it with EBMusEd and custom samples.

Inserting .ebm Files From EBMusEd Into Your Game

After creating your wonderful song in EBMusEd (refer to this page), choose File > Export Song to export it as an .ebm file. Next, on the Song Table tab, identify the song pack (in the boxes on the right) and the song number (in the list).

In your project's Music folder, find the folder labelled the same as your song's song pack (or 01 if you're making an in-engine song that avoids load times; see the note on "setting instrument pack 2 to 0xFF" below). Place your .ebm file here. Next, you have two options:

  1. Renaming the .ebm to match the song

The most straightforward method. Simply rename the existing file you're going to overwrite to something else, and then rename your song to what it used to be.

  1. Renaming the song to match the .ebm

In the parent Music folder, open songs.yml. Then, find the song number you want to overwrite there, and change the Song File entry to the name of your .ebm.

Setting The Instrument Packs For A Song

You will also need to ensure there is a .ebm.yml file in the same folder as your .ebm file with the same name - if your EBM is named abc123.ebm then the yml file should be named abc123.ebm.yml. It should contain two lines of text, informing CoilSnake about the instrument packs used for the song:

Instrument Pack 1: 0x05
Instrument Pack 2: 0x21

Replace the 0x05 and 0x21 with the primary and secondary music packs used by the song.

Setting Instrument pack 2 to 0xFF

If you don't need any instruments outside of your first instrument pack, you can set Instrument Pack 2's value to 0xFF instead of a normal pack number. 0xFF is a special value telling the game "I'm leaving Instrument Pack #2 untouched." This can be useful if you want to completely eliminate loading times before a song, or if you want a song to play with different instruments depending on the previously playing song.

If you're using this approach to cut down on load times, keep in mind that the "song pack" also needs time to load in, when you play two songs back to back that have different song packs. To completely eliminate load times, you either need to (a) set the song pack to the same as the previous song, if you know what that song is in advance, or (b) set the song pack to in-engine and put the song in pack 01. (in-engine carries the same meaning as 0xFF for the instrument pack 2 number, namely "I'm leaving the song pack untouched.")

Misunderstandings about setting the pack number to 0xFF (and in-engine, albeit to a lesser extent) have also caused numerous bugs in hacks with custom music. The game really believes that you're leaving the old instrument pack completely untouched, and it'll assume it doesn't have to reload that pack when you play another song that also uses the old instrument pack. Make sure of the following if you run into problems with a song suddenly playing with the wrong instruments out of nowhere, after checking the usual suspects like echo delay setting in the current song and previous song:

  • Check what the song playing just before this song was, and whether it uses a secondary instrument pack of 0xFF. (If not, ignore the rest of these bullet points, except maybe the echo one.)
  • Check if the previous song used echo delay that could cut into the secondary pack's space for samples. For example, using an echo delay of 03 means that the sample data must end at address E700 or earlier, if you check the instrument pack in the compiled ROM in EBMusEd. (In general, the required ending address is 0xFF00 - (echo delay * 0x800).)
    • Using a lower echo delay setting in the previous song will solve this problem, but it will affect the way the previous song sounds.
    • Shrinking the samples in Instrument Pack 2 of the current song can also solve this problem, but it may affect the way the current song sounds.
    • Switching the previous song to use a normal setting for Instrument Pack 2, instead of 0xFF, will solve this problem, but it may introduce loading times if there were previously none.
  • Check if Instrument pack 1 of the previous song is different from 0x05. If it is different and the new pack's samples take up more space, then that new pack may be overwriting parts of the secondary instrument pack.
    • If this is the case, switching the previous song to use a normal setting for Instrument Pack 2, instead of 0xFF, is probably the best option in most cases.

Managing Instrument Packs

This is actually identical to how the instrument packer functions! So if you've used that before, you'll understand how this all works.

Instrument packs are also stored under the Songs folder, and they follow the same naming pattern as the song packs themselves. Luckily there's no overlap. Simply identify the number of the instrument pack you want to edit, and navigate to the folder of that name. From here, just drop in your .brr samples and edit config.txt. It'll all be inserted when you compile your project. For instrument packer instructions, go here.