# Basic Use

## Table of Contents

- How do I insert music?
- What if I can't use AMKGUI? Or I don't want to? Or my religion disallows it?
- What about AddmusicM songs?
- Echo buffer exceeded total space in ARAM?
- When the timer drops below 100 seconds and I die, the music doesn't slow back down!
- The overworld songs are mixed up! The "Welcome to Dinosaur Land" music isn't playing!
- My sound effects aren't echoing correctly!
- This song seems to be slowing down randomly...
- Converting older hacks

## How do I insert music?

It's pretty easy. Just follow these instructions:

1. Obtain the custom music you with to use. A large collection of songs to use may be obtained here. Please note that MIDI, MP3, WAV, and other files will not work! Only the file types obtained at that link are guaranteed to work.

2. Download the song and save the whole ZIP file in the folder labelled "music".

3. Right click the ZIP folder and select "Extract All" if you're using Windows. If you are not using Windows or this option is not available for whatever reason, create a new folder in your "music" folder (named whatever you want) and copy the contents of the ZIP file into this new folder. You can delete the ZIP file at this point if you wish.

4. Go into the folder you just created and open up the text file inside. Don't worry if you don't understand what's going on inside, it's not important. For now, just type "#am4" (without quotes) at the top of the file. Make sure it's on its own line. If this was a song for AddmusicM, use "#amm" instead. Now save the file.

5. If your song is sampled, there is one extra step. Just below the "#am4" you just typed, copy and paste this in there:
   `#samples
   {
   "XXXXXXXX.bnk"
   }`
   where XXXXXXXX.bnk is the name of the bank file that was included in your song. So, for example,
   `#samples
   {
   "samples.bnk"
   }`
   Save your file again.

6. Run "AMKGUI" (if you cannot, see below for manual instructions). To add a new song, simply drag and drop the text file that's in the folder you just created into AMKGUI. The song will be inserted after your currently selected song. Alternatively, you can click the "Add new song" button, navigate to the folder you created earlier, and select the text file that contains the music (e.g. "SMB1 Theme.txt"). You can change or remove songs as well by clicking on their appropriate buttons.

7. When you have made the changes you want, hit the "Run" button, then select your ROM. After a few moments, a window showing the results given by AddmusicK will appear. If it says that the insertion was successful, then you can just close the program and continue. Otherwise, see below for solutions to common problems.

8. You can now use custom music. A file named .msc should have appeared when you ran the program. Lunar Magic can use this to determine the names of your songs, so be sure to keep it in the same directory as your ROM. Of note: If Lunar Magic is not displaying the song names for some reason, don't worry: your songs are still there. Just use the number beside the song name in AMKGUI in Lunar Magic.

## What if I can't use AMKGUI? Or I don't want to? Or my religion disallows it?

1. Once you have your song in its own folder in the "music" folder, open up "Addmusic_list.txt".

2. Add a new line at the bottom of the file, type in an unused number, and then the song's filename (including the folder you put it in). For example, "My Song/My Song.txt" (without the quotes). This will be the song number that you will use in Lunar Magic.

3. Run the program. You will be prompted for your ROM name. Make sure that your ROM is in the same directory as the program and that its name does not contain any spaces, then type in the name and hit ENTER.

4. Some text will appear on the screen describing details of each song you've inserted. Examine it if you like, then exit the program.

And that's it! All other instructions are the same as above.

## What about AddmusicM songs?

AddmusicM songs require some extra steps:

1. Open up your song's text file.

2. Look for a line or lines that look like sXX_10_14_13_12_16_15_FF or something similar.

3. At the top of the file, add the following text:
   `#samples
   {
   #default
   #AMM
   "sample10.brr"
   "sample14.brr"
   "sample13.brr"
   "sample12.brr"
   "sample16.brr"
   "sample15.brr"
   }`
   Where "sample10.brr" is the sample in blist.txt at slot 10, "sample14.brr" is the sample in blist.txt at slot 14, etc. The order of the samples must be in the order that the sXX line specified, so be careful!

4. Delete the sXX line, save the file, and then exit.

5. Copy the sample files (probably in a folder named "brr" or "samples") into your sample folder.

Let's look at an example:

1. Suppose the music file's "s" line looks like s09_10_11_14_12_FF.
2. Now suppose that that music's "blist.txt" looks something like this:

       	10  Trumpet.brr
       	11  Strings.brr
       	12  Bass.brr
       	13  Snare.brr
       	14  Cymbal.brr
       	15  Organ.brr
       	16  Choir.brr

3. Add the #samples definition.
4. The first sample would be "Trumpet.brr". The second, "Strings.brr". The third, "Cymbal.brr. The fourth, "Bass.brr".
5. All in all, the #samples definition should look like this:
   `#samples
   {
   #default
   #AMM
   "Trumpet.brr"
   "Strings.brr"
   "Cymbal.brr"
   "Bass.brr"
   }`

## Echo buffer exceeded total space in ARAM?

This is an error that may occur with some frequency with older songs (and some new ones under certain circumstances). If you get this error, there are three possible solutions. In order of effectiveness:

1. Open the offending file. Find the text "#default" and replace it with "#optimized". If this text does not exist (and the text "#samples" also does not exist), then add the following to the top of the file:
   `#samples
   {
   #optimized
   }`
   Otherwise, move on to the next step.

2. Find something that looks like "$F1 $XX $YY $ZZ", where XX YY and ZZ are numbers. Decrease $XX until you don't get any more errors. This may make the song sound a bit different, however.

3. If you've reached this step, this song is simply too big for your hack. You will either have to delete some sound effects, filter out some code or remove a global song (explained in the advanced section). This should hopefully never happen, however.

## When the timer drops below 100 seconds and I die, the music doesn't slow back down!

This is a very simple error to fix. Simply find all songs that should be "immune" to this increase in tempo (such as the death theme, the game over theme, or whatever), and add "#option tempoimmunity" (without the quotes) to the top of the music text file. That should solve the problem.

## The overworld songs are mixed up! The "Welcome to Dinosaur Land" music isn't playing!

Ah, yeah. This might happen the first time you run the program. The fixes for these are simple: just reset them in Lunar Magic. You'll only have to do this once.

## My sound effects aren't echoing correctly!

By default AddmusicK disables echo for sound effects. This is so that, for example, if you're using a song in a sky level, and that song uses an echo effect, your sound effects won't also echo and sound weird. To turn echo on, here is what you do:

1. Download uberASM from SMWCentral's patches section.
2. In the "code" folder, open up "level_init_code.asm"
3. You should see a bunch of labels that look like "`levelinit0`", "`levelinit1`", etc. Go to the label that corresponds to the level you want echoey sound effects in. For example, for level 105 you'd go to "`levelinit105`".
4. Insert this code after the label but before the `RTS`:
   `LDA #$06
   STA $1DFA`
   So all in all, that part of the file should look like this (if we're using level 105):
   `levelinit105:
   LDA #$06
   STA $1DFA
   RTS
   levelinit106:
   RTS
   `
   (etc.)
5. And that's it! Patch uberASM to your hack, and just repeat steps 2 - 5 for any level in which you want sound effects to echo.

## This song seems to be slowing down randomly...

Add the text "#halvetempo" (without the quotes) at the top of the song's text file before anything else. Note that this may not work for all songs, however.

## Converting older hacks

No extra steps should be necessary in order to convert hacks that currently use AM4 or AMM; just run the program like normal. However, it is highly recommended that you make a backup before attempting this!
Note, however, that you will need to either redownload your old songs or convert them manually. AM4Batch.exe and AMMBatch.exe may help if you decide to go with the latter, as they will automatically add the correct #am4 or #amm identifiers (though you will still need to add the #samples command).

Return to the main page