Views: 738,200,642
22 users online: adyum, charlotte1, DDC ecil, o Deeke, ElijahRulz, ExONightZ, Fenix, Flabort, Flippn'Fences, Hayashi Neru, Imnever, Jibjig, lordkronos100, Lui37, Maxodex, MercuryPenny, MuMu, OhMuramatsu, Stiviboy, o tcdw, Turret 3471, Zerukin - Guests: 49 - Bots: 76Users: 38,851 (1,929 active)
Latest: charlotte1
Tip: Layer 3 backgrounds and tides disappear when you hit a message box, so plan your level around that. For example, you can add a sublevel without layer 3 at the start/midpoint, and include your message there.Not logged in.
Wakana's Music Porting Tutorial - From the Basics to the Advanced
Forum Index - SMW Hacking - SMW Hacking Help - Tutorials - Wakana's Music Porting Tutorial - From the Basics to the Advanced
Pages: « 1 2 3 »
Wakana's Music Porting Tutorial

From the basics to the advanced


This thread aims to be a very basic tutorial for those who want to approach porting but don't know where to start. Beyond that, it goes deeper into other subjects that are useful for porters with some experience as well.
tl;dr this tutorial is for both newbies and experienced porters.

This tutorial does not assume that you have a music background: you don't need to study music theory deeply to understand it, and I am a living example of it! If you are a musician, good, some parts will be easier for you; you're not? Who cares! With a bit of patience, pretty much anyone can get a port going.

Before starting, there's one thing to keep in mind: porting is 90% experience! Don't expect to be great on your first attempt and don't expect your very first ports to be up to site standards; the more you port, the better you'll become.

If you spot any errors, please report them and they'll be corrected, thank you.

I also want to thank the following people, who all made me the porter I am today. Thanks to them, I can share my knowledge with you:
- Izuna
- CrispyYoshi
- Vitor Vilela
- Torchkas
- ...and other ones I probably forgot, sorry.

Credit to the following people who helped me iron out errors and mistakes in this tutorial:
- Vitor Vilela
- Maxodex

Credit to following people for fixing grammar errors:
- leod

Credit to following people for sharing additional knowledge other than mine:
- TheJuanCarlos64

Table of Contents

0.1. What you need to know & basic tools to have
0.2. SMW Samples
1.1. How to port a simple track
1.1.2 Triplets: suggestions on how to behave with them
1.2. Channel looping, various tecniques
2.1. ADSR, Hex commands
2.2. How to set echo
2.3. Pitch Bends: suggestions and tips
2.4. Remote Commands
3.1. External samples and tuning
3.2. Ripping .brr files from external sources & SPC files
3.2.2 Making stereo samples
4.1. SFX making
4.2. SFX with external samples
9.9 Wakana's trickeroni of the maccheroni in ports

I joined the internet yesterday, how do I hack and make music?

Before getting into porting, you have to have basic knowledge about how music is handled in Super Mario World.

SMW music is created using .txt files. You can use any text editor like notepad (or notepad++ if you wish) to write the music data needed.

What is music data made of?

Music data is made up of notes. Notes available to you are c c+ d d+ e f f+ g g+ a a+ b, making for a grand total of 12 notes per octave. An octave is simply a set of 12 notes in a sequence, before the next octave begins with the same 12 notes.
In Addmusic, you can specify octave with oX, where X goes from 1 to 5 (6 for some samples).
You can quickly move +1/-1 octave with > and < respectively.
For example:
o3 e e > b < c equivalent to...
o3 e e o4 b o3 c

A note also contains a length. The length of a note in a txt is determined by the number which immediately follows it. Basic lengths are 1, 2, 4, 8, 16, 32, 64.
A note having a length of "16" does not mean it's 16 times as long as a note of length "1". In fact, it's the opposite. A note of length "16" is only a sixteenth as long as a note of length "1", a note of length "8" is only an eighth as long, etc.
You can combine more lengths with the caret, ^. For example, you can do c1^4, b2^16, f+4^64 and so on.

If the value after the ^ is twice the value before it, you can replace it with a "." dot.
a8^16 -> a8.
a1^2^4^8 -> a1...
a2^8^16 -> a2^8.
a2^4^32 -> a2.^32
This isn't only faster to write, but will also save space in the .txt data!

Here's an image that illustrates what lengths look like in FL Studio.

Do note that there are particular note lengths, called triplets, which will be analyzed in-depht on another chapter.

If you get tired of writing notes of the same length many times troughout the same channel, use lXX.
The lXX command defines the default length for all future notes in the channel, allowing you to do something like this:
e8r8e8a8e16c32e8 -> l8 ereae16c32e

The rXX command defines a Rest. Rests are pretty much notes without volume, or pauses.

A port is made up of a maximum of 8 channels, from #0 to #7.
Each channel plays notes individually, independently of what the other channels play. The only thing they share is the looping point (starting with AMK1.1 it will be possible to give each channel an individual looping point).

Channels #6 and #7 are affected by the SFX in a rom. That's why I highly recommend not to place important notes into these channels, since as soon as an SFX plays, either #6 or #7's notes will be cut out to allow the SFX's notes to play.

In channel #0, you generally specify these 2 global properties:
- Tempo: tXX, where XX is your tempo. It defines how fast your music plays. Using high tempos (such as t80, t90, t100) is not recommended, as the port may become unstable.
- Master Volume: wXXX, where XXX is your volume. The volume value can range from 0 to 255.
Do note that you can change these values in the middle of your port as well! You'll see that there are a lot of options later down the line (samples swapping, volumes, tempos, etc..).

As for the tools you will need, in this tutorial we'll be using the following:

- AddmusicK (AMK) - Download - Allows us to insert our tracks into Super Mario World.
- SNES SPC700 Player - Download - Allows us to play back our SPC.
- Any Piano Roll MIDI Editor. I recommend FL Studio, even the free unlimited trial is more than enough to do everything said in this tutorial (only con, is that it opens your browser, with a list of bundle offers). There's also Anvil Studio, which is eehhh, and Reaper, which I never got to work, and it'll annoy you to buy the full program after the trial period expires, yet, you're nonetheless free to keep using the trial.

If you don't know how to use AMK to insert music into a ROM, this tutorial covers it.
Big thanks to Erik557 for making it!

That's it for the preliminary knowledge! Let's move onward!


I won 1st place in the Vanilla Level Design Contest, what's the equivalent for music porting? I wanna win a Vanilla Porting Contest too!

There are two types of ports: it can be unsampled or sampled.
The former means that the port uses SMW's original instruments only; the latter means that it also uses external, custom instruments.
You can mix instruments of course: a sampled port can use SMW's instruments as well, but watch out, since their styles could clash. Super Mario World's instruments would not mesh well with High Quality XG samples, for example.

Below is a list of all of SMW's samples.
While you look at each instrument, listen to this SPC.
It contains all the samples listed below in order, so you can listen to what each one sounds like.

@0 - Flute: Soft instrument, goes from o1 to o6. Can be unstable on very high notes.
@1 - String: Soft filled instrument, it goes well both as lead and as a secondary/filler instrument.
@2 - Blingy/Glockenspiel: Literally a BLING. Good for lead blings.
@3 - Marimba: It's kind of a @0 but with a much stronger beginning. Good for secondary channels; works as lead for those forest-y themes.
@4 - Cello: Closest approximation of a cello/trumpet. Great lead, very high volume. Works excellently as bass in low octaves too.
@5 - Acoustic steel guitar: ...kind of. I rarely ever use it.
@6 - Trumpet: Another kind of trumpet, softer than @4. Works as lead and as filler instrument.
@7 - Steel drums: Also known as "the instrument that always plays in beach themes!".
@8 - Acoustic Bass: 1st sample to use when it comes to bass. It's very quiet by itself, so I would suggest using a high volume (v255) to keep it audible. Works in octaves o1 o2 and o3. The higher you go, the sillier it sounds. Higher octaves (o4 onward) overflow.
@9 - Piano: SMW's piano sample.
@10 - Snare Drum: One of the best snare drum samples. Easy to use and very versatile.
@11 - String 2: The same instrument as @1 but with a softer beginning.
@12 - Bongo: Also known as "the sample that plays when you mount Yoshi! (not nsfw)".
@13 - Electric Piano: Another sample I rarely ever use.
@14 - Slap bass: 2nd sample to use when it comes to basses. Less filled than @8, but more versatile use in octaves.
@15 - Orchestra Hit: Imagine drums and strings playing together for a short instant, in a hit.
@16 - Harp: Also known as "softer version of @13".
@17 - Distortion Guitar: Objectively the best SMW sample. Works great as bass and on secondary channels. Needs some fantasy to use as lead, especially the high pitched ones.
@18 - SAME AS @1
@19 - invalid (plays as @1 in the spc)
@20 - invalid (plays as @1 in the spc)
@21 - Bass Drum: You could think of this as a kick. Deep percussion sample. Essential for most percussion.
@22 - Light cymbal: Percussion sample that goes "tz".
@23 - Maracas: Flatter version of @22 (flatter = lower pitch).
@24 - Wood block: Percussion sample, very light.
@25 - Higher Wood block: @24 but with a lower volume.
@26 - Look below
@27 - Look below
@28 - Generic Drums:
I rarely use these.
@29 - Power Set: The strongest percussion sample. Great for heavy/rock songs.
nXX - Noise: This is the noise "sample" used in NES games to do most of the percussion. XX goes from 00 to 1F. XX simply specifies its "pitch". 00 is nothing, 1F is the highest. Make sure to give this a very low volume: high volumes are used as jumpscare.

These are all the SMW samples. Go ahead and use them as you'd like!


What does "octave is too high" mean? I'm calling it quits...

This is the core part for beginners. Please, pay a lot of attention here, as once you figure this out, you already know 70% of the stuff that has to be known to port a song.
Porting is pretty much like programming: you start with very basic knowledge, and learn it... by doing it. Yes, you learn porting by porting.

The method most porters use is based around MIDI files.
What's a MIDI? A MIDI is a file containing a sequences of notes.
What we'll be doing is transcribing these sequences into our blank .txt file.

For this tutorial, we'll be porting SMB1's lovely castle theme. MIDI Download.
This very basic example should cover most of the situations you'll be facing when you want to port a different track.

Let's get going then! SMB1 Castle theme!

First, grab this empty .txt template and put it inside your AMK's "music" folder. Call it however you wish, for example, "smbcastle.txt".
The template contains the basic definition of all 8 channels with final rests (to prevent the port from ending before it should, all channels will continue playing silence once the track is over), master volume set to max and tempo set to 50.

Next, open Addmusic_list.txt, add a line containing a number followed by your song name (something like this).
Once you've done this, you can open AMKGUI.exe. Tick "porter mode" and you're ready on the AMK front (like this).
Now I would suggest you to make your operating system associate SPC files with SPC700 player directly. This way, as soon as you hit "Run", the SPC will play on the fly!
Last bit of preparation is to open your MIDI file in your piano roll editor (eg. FL Studio). Drag and drop the MIDI onto your editor and you should see this view.

Now we're ready to port!

First thing to do in the .txt are MASTER VOLUME AND TEMPO!
We have already set the master volume to max in the blank template, let's keep it like that.
What you have to change here however is the tempo.
Do you see "TEMPO" in FL Studio, in the center at the top? It's 90, right? Yes.
FL Studio's tempo is different from SMW's. Modern piano roll editors use BPM, or Beats Per Minute, so to convert it to SMW's tempo, you have to use this formula: (BPM Value)*(256/625).
If you're too lazy to open the calculator, you can use Vilelabot. Type tempo 90 and it'll output the SMW tempo for you. If you did well, you got t36-t37. We'll use t37 since it's the closest approximation.

OK, now let's transcribe!
Our MIDI is composed of 2 channels. Let's take a look at the former one: click the piano roll of the first channel. You'll get this.

So, we can see there are multiple notes playing at the same time: in fact, the very first notes playing here are an o6 d32 note on top and a o5 a+32 note below it. In this particular case, we'd have to split these two notes as SMW can only play one note per channel at a time. Splitting means that we reserve one channel for the upper note and another channel for the lower note.
"Multiple notes playing at same time" is called a chord. So, a chord is defined as 2 or more notes playing at the same time.
In our Castle Theme example, we can see chords alternating with singular notes, so let's remember that for later.

Now that we have decided what to transcribe, namely the "upper" notes of the lead, we decide on an instrument to use for these notes.
Let's say we want to use the SMW piano @9 on octave o5 with v150 volume. We'll have:

#0 w255 t37
@9 v150 o5

Let's transcribe the first 8 notes into channel #0 in our .txt. We will include both the "upper" notes of the chords as well as the singular notes on the bottom. (Remember how lengths work!)
Done correctly, it should look like this:


The notes here are all half a "square" long, so length 32. (A full single square is 16, two squares are 8, 4 squares are 4, etc)
As you can see, there's a row of g32s alterning with the upper part of the channel, and as you can see, they change octaves, so we used the > < commands to increase/decrease our piano's octave.
We did this because, as you can tell from the slightly thicker horizontal line in FL Studio, all those notes are in a lower octave. Usually the note "g" is higher than the notes "c" and "d", so to get a lower "g", we went down an octave.

Let's transcribe the next 8 notes. Keeping all the above in mind, we should end up with this in channel #0:


Make sure you understand how this works and why we have the notes that we do before moving on, as this is a very important step to understanding how to port.

If you want to test how it sounds, go ahead and run the .txt file in AMKGUI. Your output should sound exactly like this so far.
If they sound alike, continue! If not, double check your .txt and re-read everything above until you have everything just right!

It's coming along well! It's doing that mnemnomnemno of the original song! Let's keep going!

Let's take a look at the next 16 notes. If we look closely, you might notice that they are the same notes as the one we already wrote!
In that case, instead of typing everything out a second time, we can use a bracket loop. It saves space and gives you less notes to transcribe (PERFECT FOR LAZY PEOPLE!).
Adding this repeat of our notes, our channel #0 becomes this:


Sweet. As you might guess, a bracket loop simply repeats everything placed inside the brackets as often as the number right behind the bracket says.
As you might have noticed, all notes in here are length 32. This means that we can make transcribing less painful with the lXX command! Add l32 right after you defined your sample in #0 and now all notes will be length 32 unless specified otherwise!

Let's transcribe everything up to beat 4. (In FL Studio, you can see the beat number on the black horizontal line on top of the piano roll.) Take your time with this and keep in mind the bracket loops we just learned about.

When you're done, you should have something like this:

#0 @9 v150 o5 l32

Thankfully, every beat in this track consists of the same notes repeated twice!

Listening to our port, we realize that have we reached the loop point! This means that we finished transcribing into #0!

Let's now add the lower notes of the chords in FL Studio's first channel. We'll transcribe these into #1. We'll use the same sample/volume/settings we used for #0... except not really!
Look at the octave we used for #0. It's o5, in FL it's o6. This means that, if we want to be coherent with our octaves, we should continue using "FL Studio's octaves -1". That's why we'll set octave o4 for #1.
Always remember the offset between octaves in FL Studio and octaves in your txt. Using random octave values will make your port sound silly.

So yes, let's transcribe the lower notes of the chords now.
Be careful not to use the same notes you wrote in #0! That's a common error.
In #1, there will be notes alternating with rests where channel #0 plays the notes on the very bottom of the MIDI. Both notes and rests have length 32, so we can use the lXX command again.
If you didn't quite understand, we will only transcribe the red notes in this picture. The green ones are the ones we wrote into #0.

Go ahead and transcribe these now.
Writing and writing, we should eventually end up with this:

@9 v150 o4 l32

Output SPC

Yes, we're almost there! If your SPC doesn't sound like this, make sure that you didn't make any mistakes in your #1! Don't just copy and paste the solutions above, make sure to try it yourself so you can learn how to do it on your own in the future!

The only thing left to transcribe now is the bass part. Let's exit out of FL Studio's first channel now to open the second one, which contains the bass.

How it looks in FL Studio

Seems simple, no?
Let's choose the picked bass sample @8 with volume 255 at octave o2 (remember: @8 acts weird in too high octaves! It'd be better for us to just set o2 in this specific case) playing on #2.
The channel should look like this while empty:

@8 o2 v255

Now, transcribe the bass into it! The notes are of different lengths this time, so make sure you get those right! Here's a reminder!
Once finished, you should have this:

@8 o2 v255

If we wanted another sample, we could've used @14. Since @14 doesn't follow its own unique octave rules like @8, we would follow the rule we established before: FL Studio octave -1. So @14 o3.
But for now, let's keep the @8. It sounds better.

Output SPC

Well, our first port is sounding lovely, isn't it?
Last thing to fix is the looping. We want the song to play endlessly instead of stopping after one time.

Thanks to the template, you only need to identify which channel stops last. In our example, #0 #1 and #2 stop together, so it's fine to remove all the [[r2]]255 at the end of them.
We might as well remove all the channels below our 3 (#0, #1 and #2), since we have no need for those.
Now that we removed the rest loops, the song will play endlessly on repeat!


#amk 2

#0 w255 t37
@9 v150 o5 l32

@9 v150 o4 l32
> [c+rdrc+rcrc+rcr<br>cr]2

@8 o2 v255

Output SPC

We did it! We managed to port a song from another game into SMW!

Best of all, this is usable in SMW already! If you want to insert it into your rom, untick "porter mode" in AMKGUI, click "run", select your SMW ROM, and it'll insert!
Now that the song is done, you may need to adjust the master volume (wXXX), since the template set it to its max volume so you can hear it better while porting, the port may end up being too loud in game.
If it's loud enough to drown out the SFX or doesn't seem on the same level as the other music in your ROM, keep lowering it till it seems fine.

Let's update our objective.
Let's imagine that our MIDI also had percussion! MIDI Download.

Now we'll learn how to work with percussion.
Let's say we want our song to have no percussion on its first loop, but then the percussions starts on the second loop.
I created a simple percussion pattern in FL Studio for that MIDI, as seen here: (1) (2).

What we do now is to add the [[r2]]255 back at the end of #0 #1 and #2, as well as adding a blank #3, which will be our percussion channel.

So, how do we create percussion?
Percussion is kind of different from normal notes: in fact, percussion always "plays the same note" in 90% of all cases. Instead of changing the note, we change which sample plays on a certain note. Instead of making one channel per percussion sample, we'll optimize the amount of channels; rather than having 1 channel playing only a single sample, we can have the same channel play different percussion samples dynamically.
As usual, this only works if the percussion notes we want to transcribe aren't overlapped, which means they don't form a chord. If we had "chorded percussion", then we would have to proceed like we did with #0 and #1, splitting the notes each chords is composed of into different channels.

When listening to the percussion channel in FL Studio, you'll realize that we are going to need the following:
- A sample that sounds like the "BUM" (@21)
- A sample that sounds like the "PEM" (@10 or @29, @10 is softer, @29 is heavier)
- A sample that sounds like the "TSS" (@23 ).

Let's go then!
Let's define the base octave as o3, base note as c and the volume as v200, right after the #3 channel declaration.
First off, in the MIDI we can see that the percussion does not kick in until after a rest period of 3 whole notes, or 3 beats in FL Studio. Because of this, we should start the channel with r1^1^1. Remember that the caret command ^ adds lengths together. We'll use [r1]3 to optimize the size. As a reminder, [XX]Y defines the very basic bracket loop. The XX, that means everything inside the brackets, will be repeated Y times.
Since a rest does not make a sound and 3 rests each a whole note in length is equal to one rest that is 3 notes long!

After the [r1]3 is over, this channel will start playing any notes we place after the rest, as you might imagine.
So let's transcribe the percussion channel into our .txt now!
It's important to keep in mind what we discussed earlier: percussion does not change notes, it changes instruments.
This means that notes in this channel should look like the following:
"BUM" -> @21c8
"PEM" -> @10c8
"TSS" -> @23c8
Note how all of the notes play a c but switch the instrument using the @XX command in the middle of the channel.
Feel free to peek at the finished result below to get an idea of how it works, but try to work the whole channel out yourself after!

The result should look like this:

o3 v200
[@21c8 @23c8 @10c8 @23c8
@21c8 @23c8 @10c16c16 @23c16 @10c16]3

Output SPC

... brb giving up.
Nope! The problem here is rather simple.
What we have to do here is to have channels #0, #1 and #2 repeat their notes and play twice.
We can do this easily with "superloops", which are just like loops but use two pairs of brackets instead ([[XX]]Y). This would look as follows:

#0 w255 t37
@9 v150 o5 l32

As you can see, we wrapped the whole channel in one big bracket loop to play it twice and then replaced all loops that were there before with superloops; the inside ones are "superloops". You can nest loops in loops! Or, more precisely, you can nest superloops in loops or loops in superloops. There is no third kind of loop!
(Don't worry; there'll be a chapter listing all the possible loop tricks you can do. Just keep in mind that "[]" normal loops and "[ [[ ]] ]" superloops are the basic way to loop sequences of notes.)

Now let's give #1 and #2 the same treatment. Keep in mind that #2 doesn't need superloops because there were no loops originally!
Let's also remove the [[r2]]255 after every channel again to make the song loop properly once more, since all our channels finish at the same time.

Our .txt file should finally look like this:

#amk 2

#0 w255 t37
@9 v150 o5 l32

@9 v150 o4 l32

@8 o2 v255

o3 v200
[@21c8 @23c8 @10c8 @23c8
@21c8 @23c8 @10c16c16 @23c16 @10c16]3

Output SPC

YES! Our percussion is playing when we want it to! One loop without percussion, then the next loop with it, then another without, another with... ad infinitum.

To finish this basic tutorial, let's give ourselves one last goal: we don't want the percussion to stop once it starts, instead playing forever.
In other words, we want to change where the percussion channel loops to after ending, also known as the looping point.

The looping point is always the beginning of the chance by default, so if this is not what you need, you have to specify where to resume after the end is reached. This has to be done for each channel if even just one channel changes its loop point! Make sure the loop point is synced in length with the other channels, otherwise your port will desync once it reaches the loop point, meaning that notes will start to play out of order!
So, to specify a loop point inside a channel, you have to use the / command.
As an example, imagine the following note sequence:


If kept like this, after playing the final e16, the port will loop back to the beginning, to the first a8.
What if we place the / command? Let's say we place it after the rest:

a8a8a8r16 / e16e16e16

If we do this, after the final e16 plays, the channel will loop and continue playing from the / command, thus playing from the first e16 again, cutting off the entire beginning portion!

Understanding this concept, setting the loop point for channel #3 should be straightforward.
We don't want to include the beginning rest after the port loops, so what we do is the following:

o3 v200
[@21c8 @23c8 @10c8 @23c8
@21c8 @23c8 @10c16c16 @23c16 @10c16]3

And #3 is done for already! We simply cut off the Rest from the remainder of the song.

But what about #0, #1 and #2? We used a bracket loop to repeat the song, how can we possibly place the / command inbetween?
Fret not, for we can use the following looping technique:

[XX]2 -> (1)[XX] / (1)

What we did here is that we labeled the loop by placing (1) right in front of it. Doing this, we can now simply place (1) anywhere in that channel to repeat everything inside the labelled brackets.
You can have a whole bunch of these, too. Simply use different numbers in the parantheses for each label!

Back to our port, using this technique, channel #0 can be changed to this:


While channel #1 turns into the following:


Try doing channel #2 yourself now!

Do note that a (X) label loop can also be followed by a number, just like a normal bracket loop. (X)Y means that the label loop number X will be repeated Y times.

If you did everything right, this should be your final SPC output!

That's it! We successfully ported a track!

Let me summarize what we learned in this chapter:
- We learned how to insert a blank txt using AMK; we also got a good starting template, which you might want to use in your first few ports;
- We learned how to define tempo (tXX), master volume (wXXX), samples (@XX), channel volume (vXXX) and octaves (oX);
- We learned how to transcribe note patterns from a MIDI file;
- We learned basic looping tricks: bracket looping [eee]5, super looping [eee [[ddd]]3 ]4, and labeled looping (XXX)[e8e8e8 [[d8a16e32]]4 ]2 r8a8d8 (XXX)4. These will reappear in the next chapter, so if you aren't too confident with them yet then don't worry!
- We learned how to change the sample which is playing dynamically when transcribing the percussion channel with @21, @10 and @23;
- We learned how to change the start of the loop point after the port ends using the / command.

Before ending this chapter, I'd like to give you a few recommendations:
- Pick SIMPLE songs at the beginning! I suggest looking into the NES section of VGMusic; there's music for all tastes in there, and NES tracks are less complex due to being from an older console!
- If you are struggling, don't give up! As I said in the beginning, porting is mostly experience and practice makes perfect.
- Always ask for feedback: you can either make a thread on SMWCentral's "Custom Music" forum where you share your SPCs, or ask about it at #imamusic on the IRC. Feedback is important: it'll help you figure out what to avoid, what's good and what's bad. Don't get discouraged if the feedback you get is negative when you just start out. Nobody is going to leave this tutorial composing blockbuster music.
- If your MIDI of choice has more than 8 notes playing at once, be aware that you will have to sacrifice something. As a rule of thumb, always sacrifice channels that you can barely hear first.

Common Errors:
- "octave is too high/low": you either confused > and <, throwing the octaves out of whack, or the base octave you set when you defined your sample is too high/low for SMW to handle. If the octave ranges seem fine, then double check the piano roll, you probably missed a > or a <; if the range is too high/low for SMW, try increasing/lowering your octave definition.
- "label redefinition": you used the same number for two label loops. For example, (1)[e8e8r8a8e8] (1)[c8a8e8r16]. Easy fix, replace one of the labels with a different number. For example: (1)[e8e8r8a8e8] (69)[e8a8e8r16].
- If you encounter any other errors, please post in this thread so they can be added here!

That's all there is to the very basics, the bottom bricks, the skeleton, of porting.
You've already done the biggest step in learning how to port by reading this tutorial. From here on out, just practice a lot, ask for feedback, learn what's good and what's bad practice and given enough time you'll be porting with the best some day.

Once you feel that you have mastered the basics, you can go ahead and read the next chapters, but I would recommend that you try your hand at porting a few tracks on your very own before you do, just to really get all this info anchored in your head!


1.1.2 Triplets: suggestions on how to behave with them
Stuff is getting trippy here...

We got the hang of it! I finally can port stuff for SMW yaaay!
Let's port some lovely music... hmm... ya! This one! Get it too!

This midi is sounding great! Let's give it a look on FL Studio ya?
Let's focus on the lead channel (the 6th one). Let's start porting!

How it looks like.

What the hell of lengths are these?
Let's try zooming, maybe I'm just tired.

How it looks like.

Yup. Something here isn't right.

Do you remember note length? Look here if you don't!

The channel here though... we all got that the first note playing is a c16, ye... but the ones after it?
It looks like there are 3 notes of the same length inside a length 16.
We have a length that specified 1/2 of length 16 (g32) and 1/4 of length16 (g64), but we'd need a length that's inbetween these.

Whenever your notes lengths look like they're nothing immediately figurable, know that those are triplets.

Musicians know very well what a triplet is. But we're not musicians, so we don't care. What we will care for is how to get these in our txt!

If you're on FL Studio, try clicking this thing. This thing will change how notes look like by changing the way beats are divided. Set it to 1/3 step.

How it looks like.

OH! It's slowly making sense now!
... well, not really.
The question is still up: there are probably note lengths that Wakana didn't talk about yet.
You were right.
The answer is all inside these two pics: (1) (2)

So yeah, if we wanted to sum up ALL the lengths you could have, the full list is down here:
- Length 1
- Length 2

- Length 3 (triplet of 1, or {1})
- Length 4
- Length 6 (triplet of 2, or {2})
- Length 8
- Length 12 (triplet of 4, or {4})
- Length 16
- Length 24 (triplet of 8, or {8})
- Length 32
- Length 48 (triplet of 16, or {16})
- Length 64
- Length 92 (triplet of 32, or {32}, not sure if it's invalid)
- Length 184 (triplet of 64, or {64}, not sure if it's invalid)

After all this, let's try porting the first notes playing in our midi.

A possible result is the following:

#amk 2
#0 w250 t41
@9 v250 o5 l48
c24. < g f d+ d c < a+ a g f r12 a+24 a12 g24 f f+24. f24 d+12 c24 a+12. a+12 a12^48 g f+ f d+ d c < a+ a g

I added simple percussions to prove you it syncs. Listen my output here!

I can understand your confusion. Think that I took YEARS to figure out all this, and nowadays I still fail sometime when getting triplets right.
After all, it's just a matter of getting the right beats view setting (if normal or if 1/3 beat) and figuring out how much a single square's length is.

Practice makes perfect! Save those two pics containing the length in your most precious HDD and study them (or keep them open when you meet triplets).

That's all for triplets.
We also closed everything it has to be said about note lengths.


What? Excess ARAM? But I have no echo in my port!

In the previous chapter we noticed that a good thing to do for both your laziness and the port's size, is to loop note patterns that repeat more than once.
First thing to be known: DON'T LOOP SINGLE NOTES! This will lead to a bigger insert size!

Listing here all the looping tecniques I know. If I forgot some, let me know.

- [XXX]Y : Normal loop bracket. XXX will repeat Y times.

- (X)[YYY]Z : Labeled loop bracket: YYY will repeat Z times. The pattern can be recalled after you define it by placing (X) again. Note that the recall can also be followed by a number which specifies the number of times it has to repeat.

- [[XXX]] : Super loop bracket. It can be used in the following ways:
1. [ [[XXX]]Y ZZZ]A - You can nest loops in loops. The inside ones must be super loop brackets, external ones must be normal loop brackets. In the example, XXX plays Y times, then ZZZ plays. All this repeats A times.
2. [[ (X)[YYY]Z AAA (X)B CCC ]]D - You can nest label loop definitions and recalls with super loops. In the example, we're defining label X which plays YYY. At first it plays Z times, then AAA plays, then YYY plays for B times, then CCC plays. All this repeats for D times.

- *X : Loop recaller. What this does is to repeat the last bracket loop you specified in your channel by X more times.
Examples of its usage
1. [XXX]Y ZZZ *A - In this case, * is playing XXX repeated A times.
2. [XXX]Y [YYY]Z *A - In this case, * is playing YYY repeated A times.
3. (X)[YYY]Z *A - In this case, * equals to (X) repeated A times.

Depending on the sadism of the music you decided to port, you'll need these.
That's all for looping, really.


2.1. ADSR and Hex Commands
Whoa! Is that unsampled???

Let's make a tiny step forward and let's explain what makes SMW Samples differ from the standard: ADSR.
Before starting, I suggest you to wear some headphones. You're going to spot tiny difference between how samples play, so I suggest atleast earplugs, lol. Take this as a global suggestion anyways: with headphones, you port better.
Don't worry, I'm not going to rape your ears (hopefully!).

I want to start by questioning you the following: knowing how smw samples sound, identify the sample playing in here!

...Why are you having difficulties?
Hm? It's a @0? It's a @1? ... a @11? lol

It's a @3. A @3 with an ADSR inside it. Yes, that's the power of ADSR!
As you can listen, it doesn't sound like a marimba anymore. It looks like an alternate version of @0, or @1. It's like @0 and @1 together.

Now what's ADSR?

ADSR is the most basic hex command you can apply in your port.
We'll see that there are a giant amount of hex commands you can apply; they can affect a single note, a single channel, the whole port... but let's not run too far!

If we wanted to be precise ala scientific teacher which none gives fucks to, I'd tell you that each letter composing ADSR has a meaning, I'd report the graph you can find in the AMK readme... but I'm gonna teach you it in the deaf way, because that's the most efficient way to learn it!

An ADSR command edits the red line you see in the SPC player. This thingy here.
Depending on the ADSR values, the line is going to be stuck, to play fast, to play slowly, and much more!

ADSR is a command that generally is specified after a sample definition, but you can also define it between notes.

How does ADSR look like?


This is the hex command that defines ADSR. There's $ED at the beginning, and then other values. Depending on these values you'll get different results.

Best way to learn ADSR is without words... yes. I'll now experiment what each letter does in an ADSR.

Let's start with the very basic ADSR: $ED$7F$E0
Don't panic, these look like random values, but you'll see later they're not.

Let's use a sample together with this. Since I recently had a dream about @17, let's use @17.
So ya!


Let's focus on the Q. Let's see how it changes.
Write the following on a txt:

#amk 2
#0 w150 t50
@17 $ed$7f$e0 c1r2
@17 $ed$7f$e1 c1r2
@17 $ed$7f$e2 c1r2
@17 $ed$7f$e3 c1r2
@17 $ed$7f$e4 c1r2
@17 $ed$7f$e5 c1r2
@17 $ed$7f$e6 c1r2
@17 $ed$7f$e7 c1r2
@17 $ed$7f$e8 c1r2
@17 $ed$7f$e9 c1r2
@17 $ed$7f$ea c1r2
@17 $ed$7f$eb c1r2
@17 $ed$7f$ec c1r2
@17 $ed$7f$ed c1r2
@17 $ed$7f$ee c1r2
@17 $ed$7f$ef c1r2

Output SPC
Focus on the red line in the SPC player.
What happens on Q?
If it's 0, the red line on the spc player is stuck on top.
If it's 1, it barely goes down slowly.
If it's 2, it goes down a tiny bit faster.
If it's F, it goes down pretty fast.
Simple no? What Q does is to control how much the note is sustained pretty much.
Its value goes from 0 (stuck forever) to F (goes down immediately).


Now focus on the Y!
Write this on your txt:

#amk 2
#0 w150 t50
@17 $ed$7f$e0 c1r2
@17 $ed$7e$e0 c1r2
@17 $ed$7d$e0 c1r2
@17 $ed$7c$e0 c1r2
@17 $ed$7b$e0 c1r2
@17 $ed$7a$e0 c1r2
@17 $ed$79$e0 c1r2
@17 $ed$78$e0 c1r2
@17 $ed$77$e0 c1r2
@17 $ed$76$e0 c1r2
@17 $ed$75$e0 c1r2
@17 $ed$74$e0 c1r2
@17 $ed$73$e0 c1r2
@17 $ed$72$e0 c1r2
@17 $ed$71$e0 c1r2
@17 $ed$70$e0 c1r2

Output SPC
Again, focus on the red line! We gave Y values from F to 0. Let's see:
If it's F, all normal.
If it's E, nothing much changes.
If it's D, same.
If it's C, eh..
If it's B, same too..?
If it's A, and if you have a good ear, you probably spotted a difference.
If it's 9, it's... softer?
If it's 8, it's even softer?
If it's 0, the red bar goes up veeeery slowly.

Here too, you probably guessed. Y is like Q, but with a difference: Q acts at the end of the note, while Y acts at its beginning.
What this means? It means that:
- If Y is F, the note instantly plays;
- If it's 0, it'll take a good while to reach the max value of the red bar on the SPC player.

With these two values alone, you can do a lot already! Q and Y are also the easier values to understand. That's why I explained these first.

I'm gonna now explain X and Z, which are the trickiest one to figure out. Pay attention!


Let's start with Z. While I'll explain Z, I'll also let you see how X is connected to it.

Z is a prick, because you could divide the effects of its values in 2 big groups:
- Group of even values (0,2,4,6,8,a,c,e)
- Group of odd values (1,3,5,7,9,b,d,f)

Let's focus on the even values for now.

Write the following on your txt. We're editing the Z only, in particular, we're giving it the even values:

#amk 2
#0 w150 t50
@17 $ed$7f$e0 c1r2
@17 $ed$7f$c0 c1r2
@17 $ed$7f$a0 c1r2
@17 $ed$7f$80 c1r2
@17 $ed$7f$60 c1r2
@17 $ed$7f$40 c1r2
@17 $ed$7f$20 c1r2
@17 $ed$7f$00 c1r2

Output SPC
What are the changes here on the red line?
If it's E, all normal, the red line reaches the very top.
If it's C, it looks like that the very peak isn't reached anymore. It stops lower.
If it's A, it stops even earlier.
If it's 0, it stops almost at the beginning.

What Z does with the even values is to define the "limit" that the red line reaches. Max is E, minimum is 0.

Now, let's see how X makes the red line different.
Let's decide to "set our red line's limit to 6". So Z will be 6.
Write this in your .txt:

#amk 2
#0 w150 t50
@17 $ed$7f$60 c1r2
@17 $ed$6f$60 c1r2
@17 $ed$5f$60 c1r2
@17 $ed$4f$60 c1r2
@17 $ed$3f$60 c1r2
@17 $ed$2f$60 c1r2
@17 $ed$1f$60 c1r2
@17 $ed$0f$60 c1r2

Output SPC

Okay let's see how stuff changes depending on the X:
If it's 7, all normal.
If it's 6... also all seem normal.
If it's 5, seems normal.
If it's 4- WHA! Did you see?? For a moment, the red line reached the very top!
If it's 3, you can clearly see the red line reaches the top first, then quickly goes down to the limit we set with the value in Z.
If it's 0, you probably figured.

So yeah: Z and X work together:
- Z defines a sort of "limit" to reach for the red line.
- X defines how fast the red line is in the moment from when it reaches the top of the spc player till the limit set from Z.

If you're confused, remember: the "limit" set for Z is actually a fake limit. The note will always reach the top of the spc player. When the X is 7 aka the max value, it's like the red line reaches the top, then instantly reaches the limit set by Z. The lower the X value is, the slower the "limit" is reached, starting from the top of spc player.

I fear like I didn't explained this too well. If that's the case, let me know and I'll try articulating this differently!


Last thing left to see, the Z on odd values.
Again let's write this on our .txt:

#amk 2
#0 w150 t50
@17 $ed$7f$f0 c1r2
@17 $ed$7f$d0 c1r2
@17 $ed$7f$b0 c1r2
@17 $ed$7f$90 c1r2
@17 $ed$7f$70 c1r2
@17 $ed$7f$50 c1r2
@17 $ed$7f$30 c1r2
@17 $ed$7f$10 c1r2

Output SPC
...yes, your reaction is understandable.
Z here still sets a "fake limit" for our sample to play, except that this time, the sample also fades!
Not only! Note that when you set Z to an odd value, the fade goes faster than when you set your Q value to F! Yeah, that may be a tiny difference, but it (should be) 's true!

So ye, we automatically said that setting Q to F isn't the fastest way for your sample to fade out. Infact, there is an addition of 16 more values you can have!
Imagine this: setting Q defines these speeds of fade.

0 - no fade
1 - very slow fade
2 - a bit faster fade
F - the faster fade?

After F you have 10 in hexdecimal!

10 - Faster than fastest fade
11 - Even faster!
12 - FAST!

Do note that in the second block, there's an extra value. 1 and 0 (10), 1 and 1 (11), 1 and 2 (12)...
Now imagine doing it on the adsr.
If you are smart, so smart that everyone should kneel before you, you probably got why we had to make a difference between odd and even values of Z. Yes, BECAUSE ODD VALUES CONTINUE WHAT Q'S FUNCTION IS FOR, THAT IS, TO FADE THE SAMPLE FASTER! #smw{O_O!}

Let's see the whole thing then. Let's copy the block we wrote when we talked about Q, and let's add another block, which increases Z by 1 (making it odd!) and Q restarts from 0.

#amk 2
#0 w150 t50
@17 $ed$7f$e0 c1r2
@17 $ed$7f$e1 c1r2
@17 $ed$7f$e2 c1r2
@17 $ed$7f$e3 c1r2
@17 $ed$7f$e4 c1r2
@17 $ed$7f$e5 c1r2
@17 $ed$7f$e6 c1r2
@17 $ed$7f$e7 c1r2
@17 $ed$7f$e8 c1r2
@17 $ed$7f$e9 c1r2
@17 $ed$7f$ea c1r2
@17 $ed$7f$eb c1r2
@17 $ed$7f$ec c1r2
@17 $ed$7f$ed c1r2
@17 $ed$7f$ee c1r2
@17 $ed$7f$ef c1r2
@17 $ed$7f$f0 c1r2
@17 $ed$7f$f1 c1r2
@17 $ed$7f$f2 c1r2
@17 $ed$7f$f3 c1r2
@17 $ed$7f$f4 c1r2
@17 $ed$7f$f5 c1r2
@17 $ed$7f$f6 c1r2
@17 $ed$7f$f7 c1r2
@17 $ed$7f$f8 c1r2
@17 $ed$7f$f9 c1r2
@17 $ed$7f$fa c1r2
@17 $ed$7f$fb c1r2
@17 $ed$7f$fc c1r2
@17 $ed$7f$fd c1r2
@17 $ed$7f$fe c1r2
@17 $ed$7f$ff c1r2

Output SPC

If you keep track of this big list while listening to the output SPC, you'll figure out that what I said is true. If Z is even and you reached Q = F but you want your sample to fade faster, do Z + 1, and start setting Q values from 0 (slower) to F (so fast that you barely see it)!

...and that's all for ADSR.
As you can see, there was a lot to say on ADSR, even though it's a very simple hex command on first look.

Before ending the chapter, you must know that there are two ways of making an ADSR'd sample:
1. By defining the ADSR after the @XX. The simpler way, and it's how we did it in our examples earlier.
2. Doing it with #instruments. This one is comfy to use, since you won't need to do @AA $ED$XY$ZQ every time.

We saw how to do it in the first way; now let's quickly see how to do it with #instruments.

Imagine we have this ADSRd sample: @1 $ED$7F$75
We want to "convert" it to use with #instruments.

On #instruments, you'd have something like this (copy the whole .txt):

#amk 2

@1 $FF $75 $00 $03 $00

#0 w200 t50
@30 v150 o4 c1

Let's see what the hell I did.
Inside the curly brackets of #instruments, you define the ADSRd samples. The order of the informations is the following:
- $FF: FIRST BYTE OF ADSR + $80 (doing $7F + $80 equals to $FF)
(use this only if your ADSR values are 00. If this happens, you can use GAIN, which is an alternative to ADSR. I won't enter in the details, unless you will ask to).
- $03 $00: SAMPLE TUNING.

Think of #instruments as a list. Infact, the first sample you define can be recalled with @30. If we defined another one under it, it would've been recalled with @31, and so on.

Oh, and don't worry about SMW samples' tunings, I made this list for you so you won't have to guess values:

SMW Samples' tuning values
Note: the format used is the ones used by #instruments

@0 $FE, $6A, $B8, $06, $00
@1 $FA, $6A, $B8, $03, $00
@2 $AE, $2F, $B8, $03, $00 (NOTE: SMW uses $04$00 as tuning, but this is detuned when applied with #instruments. $03$00 is the way to go, instead.)
@3 $FE, $6A, $B8, $03, $00
@4 $A9, $6A, $B8, $03, $00
@5 $AE, $26, $B8, $07, $00
@6 $FA, $6A, $B8, $03, $00
@7 $9E, $1F, $B8, $03, $00
@8 $AE, $26, $B8, $1E, $00
@9 $EE, $6A, $B8, $02, $AD (NOTE: SMW uses $05$59)
@10 $FE, $6A, $B8, $08, $00
@11 $F7, $6A, $B8, $03, $00
@12 $0E, $6A, $7F, $04, $00
@13 $FE, $6A, $B8, $03, $00
@14 $AE, $26, $B8, $07, $00
@15 $8E, $E0, $B8, $01, $E4
@16 $FE, $70, $B8, $03, $00
@17 $FE, $6A, $B8, $05, $00
@18 $E9, $6A, $B8, $03, $00
@19 $0F, $6A, $7F, $03, $00

@21 $0F, $6A, $7F, $03, $00 (o4 e)
@22 $0E, $6A, $40, $07, $00 (o4 c)
@23 $8C, $E0, $70, $07, $00 (o3 a)
@24 $FE, $6A, $B8, $07, $00 (o3 a)
@25 $FE, $6A, $B8, $08, $00 (o3 a)
@26 $FE, $6A, $B8, $02, $00 (o3 e)
@27 $7E, $6A, $7F, $08, $00 (o4 d)
@28 $7E, $6A, $30, $08, $00 (o4 d)
@29 $0E, $6A, $7F, $03, $00 (o3 a)

Sample, Tuning
@0 $06$00
@1 $03$00
@2 $03$00
@3 $03$00
@4 $03$00
@5 $07$00
@6 $03$00
@7 $03$00
@8 $1E$00
@9 $02$00
@10 $08$00
@11 $03$00
@12 $04$00
@13 $03$00
@14 $07$00
@15 $03$00
@16 $03$00
@17 $05$00
@18 $03$00
@19 NOPE
@20 NOPE
@21 $03$00 Note o4 e
@22 $07$00 Note o4 c
@23 $07$00 Note o3 a
@24 $07$00 Note o4 c
@25 $08$00 Note o4 c
@26 $02$00 Note o3 e
@27 $08$00 Note o4 d
@28 $08$00 Note o4 d
@29 $03$00 Note o3 a

If I wronged some value, let me know, lol.

You can screenshot this list and save it on your pc so that you can get tunings on the fly, depending on the sample you specified.


- Q controls the fade-out speed of your sample. 0 will play forever, F will fadeout as fast as Q can.
- Y controls the fade-in speed of your sample. 0 will make the fade-in extremly slow, F makes it instant.
- Z's behavour depends on it being an even (0,2,4,8,A,C,E) or odd (1,3,5,7,9,B,D,F) value. In both cases, it'll set a limit for the red bar in SPC700 player to reach. Although, while in the even values it won't affect the fadeout speed, in the odd values the fade speed will be Q + 10 times faster.
- X controls the speed when the peak of the red bar in the SPC700 player is reached. 0 is the slowest speed, 7 is the fastest.
- In case you want to define an ADSRd instrument with the command #instruments, the format is:
- If you go with #instruments, make sure to do X value + 80 in hex from the normal $ED$XY$ZQ ADSR! (Example: @17 $ED$35$69 becomes @17 $B5$69 in #instruments)
- Each SMW sample has its tuning value ($CC$DD) which you can see in the list a few lines on top.

Last thing worth pointing out, a thread with some ADSR ready to use exists. Check it here!

ADSR is, obviously, not the only command you can use in a port. Infact, if you check the readme in your amk folder ("readme.html") and go to "Hex Command Reference", you'll see an huge table containing all the hex commands you could use.
Each one has its first byte, the name, the description, and the description of its following parameters.
Listing all of them here would be redundant and useless. Their usage is also pretty straight forward. If it's not, then experiment yourself like we did with ADSR: give values and see their effect on spc player.

Obviously, some commands require some more experimentation, but do not fear: if there's an hex command you can't understand, tell me, and I'll extend this chapter.
For now, I'll end it here. Hope you got everything!


2.2. How to set echo
Are you okay? okay? okay?

WARNING! From here, I highly suggest using headphones. As it has been said previously, you port better with headphones.

Echo is one of the most used commands inside a port. It's a great way to make your port more "filled", as in, less empty overall.

But first, what is echo?

Imagine you have two channels, playing the same thing, but the second one has a lower volume and a certain delay compared to the first one.

Do something like this:

#amk 2
#0 w255 t50
(1)[@9 c4e4a4>e4a4<c4e4a4c8a8e8]/r1

v140 r16

We get this.
This is the definition of echo: a copy of the same channel with less volume and a certain delay.

We used 2 channels though! A golden rule of porting is to not waste channels if it's not worth it.
In this case, it's not worth it because we can use the echo command!

Copy paste this:

#amk 2
#0 w255 t50
(1)[@9 c4e4a4>e4a4<c4e4a4c8a8e8]/r1

We get this.
See? We get the same result, but using only one channel!

In short, the echo command is this one:


The coloured bytes are the ones which can be edited by the porter.
I'll now explain what each byte does in the detail.

$AA: This simply specifies which channel has echo and which doesn't.
This is handled bit-wise, in this way: imagine all the 8 channels, but in a reversed order:

#7 #6 #5 #4 #3 #2 #1 #0
0  0  0  0  0  0  0  0

Depending on the values you have under each channel (if 0 or 1), you'll enable echo only in certain channels.

EXAMPLE: I want to enable echo in #7, #3 and #0. What do I do?

#7 #6 #5 #4 #3 #2 #1 #0

1  0  0  0  1  0  0  1

Set 1 to enabled channels, and 0 to disabled channels.
We get 10001001. Convert the value in HEX with a calculator and we get $89.
If you put $89, you'll see that #0, #3 and #7 have their channels echoed (the green "E" in the SPC player).
Wow! So it means that, if I want to disable echo in one channel in the middle of the port, I have to redefine echo again??
Nah, there is a comfier way. You can infact use $f4$03, which will quickly enable or disable the echo in the middle of the port in a certain channel.

#0 aebabe $f4$03 abebbeb $f4$03 eeeeee

If I have no echo at beginning, after the first $f4$03, echo will be enabled on #0, while after the second one, it gets disabled, always on #0 only.
So ye, no need to recall all the 8 bytes over and over. A lazy way would be to set $AA to $FF (all channels have echo), and then edit manually which channel has echo and which doesn't with $f4$03.

$BB $CC: these are echo volumes:
- $BB is the left volume and $CC is the right volume.
- $00 is no volume;
- $80 is max volume;
- From $80 to $FF you have surround volume, $FF being the lowest, $7F being the highest.
These are the values that beginners abuse a lot, in particular, when going unsampled. Watch out, since you'll need small values in here most of the times.

$DD: this is the delay. Remember when we defined what echo is? Yes, a copy of the same channel with less volume and a certain delay.
Simply put, the delay is specified by this byte. $00 is no delay, $0F is max delay (I think?).
Do note that this byte will take space in ARAM! What this means? It means that, if you have big samples and a big echo delay, you'll most likely get the very famous error "aram excess 0xYYYY bytes". Easy fix is to tone the echo delay down (or to use smaller samples).

$EE: this is the "reverb". It follows the same rules as volumes for its values: $00 is no reverb, $80 is max reverb, $7F to $FF you get surround reverb.
The bigger the reverb is, the more "muddy" your port will sound. I always suggest to not exhaggerate with huge values here. Having a big reverb is very good sometimes, especially with sampled ports.

$FF: FIR filter. This is a special byte which will allow you to enable AMK's standard FIR filter or not.
We're going in the advanced here, so for now I'll just say this: setting it to $00 will make your echo kinda muddy, while if you set to $01, your echoed notes will sound more defined.
The difference is very thin. To compare them, take a listen to these two spcs: NO FIR WITH FIR

Note that you can specify your own FIR filter too!
To do this, you use the command $F5$XX$YY$ZZ$AA$BB$CC$DD$EE.
By default, if you set FIR to $01 when you define your echo, the $F5 values are $7F$00$00$00$00$00$00$00.
You can see your FIR filter values in your SPC player too, as well as all the info about your echo settings (delay, L and R volumes, feedback, etc.).

That's all for echo!
Do note that, during the years, I figured some really cool tricks which you can use with echo. I'll explain them in the last chapter, so give it a look (if it's completed)!

If you want to know more about echo, I suggest you to give a read to this. It's a bit more complex in terms, but it also covers things that I didn't approach in the detail here.


2.3. Pitch Bends: suggestions and tips
For your own uuuuuaaaiiii!

Note: this chapter will just show how I do pitch bends. This isn't the intended nor the correct way to work with it, but it can still be useful for others.

So, if you came this far, you probably heard about the Pitch Bend command: its purpose is to go from one note to another in a smooth way.
An example is this.

Let's now analyze the command for it: $DD$XX$YY*note*

First golden rule: you have to place this after the note you want the effect on.
For example:

c8d8 $dd$xx$yy*note* e8

In this case, the effect of the pitch bend is applied on note d8.

Okay, so let's see what each byte does:

- $XX: what this does is to define a delay before the effect kicks in.
Example of it in action:

#0 w255 t80
@0 o4 c16 $dd$00$40>c ^1 r8
@0 o4 c16 $dd$0A$40>c ^1 r8
@0 o4 c16 $dd$15$40>c ^1 r8
@0 o4 c16 $dd$30$40>c ^1 r8

The higher $XX is, the longer is the delay before the effect.

- $YY: this is the speed the first note reaches the last note. Higher value means it goes slower!
Example of it in action:

#0 w255 t80
@0 o4 c16 $dd$00$40>c ^1 r8
@0 o4 c16 $dd$00$20>c ^1 r8
@0 o4 c16 $dd$00$10>c ^1 r8
@0 o4 c16 $dd$00$05>c ^1 r8


There's a table in AMK's readme which defines all basic lengths for hex commands that require length inputs. You can get a pic here!

- *note*: know that this should've been a $ZZ, but I always suggest to put a note here, for an easier understanding of the command.
What this parameter does is to define the note that has to be reached.

To put it simple, it's like you have to apply the command between 2 notes: the one in left is the beginning note, the right one is the final note.
Examples for better understanding:

#0 w255 t80
@0 o4 c16 $dd$00$40>c ^1 r8   ;Pitch bend between o4 c and o5 c
@0 o3 f16 $dd$00$40>>a+ ^1 r8 ;Pitch bend between o3 f and o5 a+
@0 o5 c16 $dd$00$40<<<e ^1 r8 ;Pitch bend between o5 c and o2 e


Do note that you can chain multiple pitch bends too!
Example below:

#0 w255 t80
@0 o4
c16 $dd$00$40>>c ^2 ;First pitch bend between o4 c and o6 c
$dd$00$20<e ^4 ; Second pitch bend between previous o6 c and o5 e
$dd$00$50<c+ ^2 ; Third pitch bend between previous o5 e and o4 c+



Now that we explained the main thing, let's see how we translate a pitch bend.
The things that you have to note are the following:
- Is there some delay before the effect starts?
- How fast it goes?
- Is it chained to other pitch bends?

Let's make a pratical example. We want to make this pitch bend.

Analyzing it, we can describe it this way:
(1) There is some delay before the effect, more exactly, an 8. delay.
(2) Starting note is a o5 c.
(3) After an 8. delay, the effect starts, the effect length is 8. till it gets to o5 e
(4) The o5 e lasts for a 4^16 length.
(5) After it, there's a chained pitch bend, which starts from o5 e to o5 c. The effect's length is 4^16.
(6) The note stops.

Let's build it step by step:

- (1) and (2) makes us realise we have to write this:

#0 t50 @0
o5 c8. ;starting delay

- (3) makes us write this:

#0 t50 @0
o5 c8. ;starting delay
^8. $dd$00$30e ;first pitch bend

- (4) will make us simply add this:

#0 t50 @0
o5 c8. ;starting delay
^8. $dd$00$30e ;first pitch bend
^4^16 ; duration of the red note in pic

- (5) pretty much another pitch bend to chain with the previous stuff:

#0 t50 @0
o5 c8. ;starting delay
^8. $dd$00$30e ;first pitch bend
^4^16 ; duration of the red note in pic
$dd$00$3Cc ^4^16 ;second pitch bend

- (6) the note stops. End.

Result is this.

Some additional notes for you:

- As you may noticed, delay with my method is always $00. I personally don't like to define delay in the command itself. Defining it directly via notes makes it much more readable.
It's like you compare...
d8 $dd$0c$30>d8

d16 ^16 $dd$00$30>d8

The latter is more readable: there's a delay of 16 before the effect starts.

- For the values in $YY you can refer to the lengths pic I showed before (this). Remember that you can also add lengths.
Example, 4^16 equals to $30 (length 4) + $0C (length 16) = $3C.

- Depending on the tempo of your song, the length of your effects can vary. Higher tempo makes your effects faster, and vice versa.

That's all that has to be said about Pitch Bends.

To sum it up:
- Define a delay (if there is some) directly before your pitch bended note starts.
- Define the note affected to the pitch bend.
- Define the $DD$XX$YY*note* command.



2.4 Remote commands
Performances... or MAKE MORE ACCURACY?

With this chapter, I'm showing you a powerful function which I suggest to use but to not abuse too much.
Infact, this command is one of the main offenders when it's about weirdness in tempo with your song. If you sense slowdown in your port and you used a lots of remote commands, I suggest you to remove some of them.

What's remote command?
A remote command is a function which makes you able to input a certain sequence of commands whenever an event occurs.
Example: you want something to happen when your note stops? Or maybe you want to make something happen after a certain note length is reached?
You do all this with this command.

How to set one?
When you want to use a remote command, you have to follow two phases pretty much:
- Definition of your remote command.
- Definition of when it has to happen.

The first phase implies in you writing something like this:


An example is below: I want my instrument to have a certain ADSR:


Remember that remote command definitions have to be outside the music channels!

So, we defined our remote command. Now we have to state the rule for it (phase 2).
Rules have to be writted inside music channels. If you write it in #0 for example, channel #0 will be affected by the remote command and it'll act accordingly to the rule you set.

Examples of stating rules for your remote command are the following:


#0 w255 t50



The list of possible rules (aka what you write after the !XXX) is stated in AMK's readme (syntax reference). I'm copypasting it below:

- 0: Disable the remote commands for this channel, including the "key on" event type if it's also running. Note that whatever code is used for this event is not run, so any code can be used.
- 1: Run code some amount of time after a note begins. Ties and rests won't trigger this event. If you want to run code as a note begins, use -1. This requires a third argument: the amount of time to wait. If the time to wait is longer than the current note, the code will never be triggered.
- 2: Run code until some amount of time before a note ends. Relative to the qXX command. This will only work on notes shorter than 80 ticks (a little more than a half note) due to the internal method in which the NSPC engine handles ties and such, so anything beyond that you'll have to use events 3 or 4. This requires a third argument: the amount of time to wait. If the time to wait is longer than the current note, the code will never be triggered.
- 3: Run code whenever a note is keyed off. This is also relative to the qXX command. Unlike 2, this cancels the note cut event, so the note keeps playing. The note is absolutely keyed off, however, before the next note begins (this does not trigger this event).
- 4: Run once, right now. This is also compatible with all other events, and because it can be used within loops, it effectively allows you to have a third layer of nested loops (see [[ ]] for the second layer).
- 5: Reserved. Do not use this event type.
- -1: Run code whenever a note is keyed on. This will allow you to undo the changes done by other events. It can be run alongside other event types.


I must admit that I don't toy lots with this command, so I can't give you many pratical examples.
I can show you, though, one of the most common applications I find for remote commands.

Listen to this.

Now listen this.

The second one sounds much smoother, isn't it?
This, because the second one has some remote command settings.
They're showed below:

#amk 2

@9 $FF$E0$00$03$00

;First phase of remote commands

#0 t50 @30 l16

;Second phase of remote commands


I first defined two remote commands in the first phase:
- (!800) triggers $f4$09, an hex commands which restores the instrument's original ADSR;
- (!801) triggers $ed$7f$f6, an hex command that will change the current instrument's ADSR.

After it, I defined the following rules in the second phase:
- (!800,-1) means that the remote command will be called whenever a new note starts. It's like I write $f4$09 after each note in my .txt.
- (!801,3) means that the remote command will be called whenever "a note is keyed off", aka, when a rest is played.

In short, if you consider my notes sequence:


My remote commands does this to it:

$f4$09 e
$ed$7f$f6 e
$f4$09 f
$ed$7f$f6 f
$f4$09 a
$f4$09 e
$f4$09 d
$ed$7f$f6 d
$f4$09 a
$f4$09 e
$f4$09 e
$f4$09 b
$f4$09 a
$ed$7f$f6 a
$f4$09 a
$f4$09 e
$f4$09 d
$ed$7f$f6 d
$f4$09 e

Normal notes will all be followed by a $f4$09, while all the rests will transform into the last played note filtered by the new ADSR.

I highly suggest you this remote commands setting, since it makes your notes smoother. If you think about it, irl also works like this: it's not like a sample instantly stops playing; it's like there's some sort of quick ADSR that makes it go to zero volume.

That's all.
Feel free to mess with other rule statements if you feel like experimenting with remote commands.
Again, don't abuse them too much, since they slow down your music!


3.1. External samples and tuning
Oh god! Is that even SNES???

Okay, now stuff gets interesting.
Let's give ourselves the following goal: we previously ported the SMB1 Castle theme in an unsampled way. Let's turn it sampled now!

Before starting anything, download this tool!
This tool allows you to play .brr files. It's an essential tool if you want to work with external samples.

Okay so... in case you forgot, in chapter 1.1. we ported this song together. We now want to make a sampled version of it.

Remember that this is just an example: deciding if doing unsampled or sampled is something you decide at the beginning! If you go from unsampled to sampled (or vice versa), the final port would lose some quality due to the transistion. This happens because you originally thought about it porting unsampled, so you applied various hex commands that on 99% won't work well with the alternate version!
What I'm saying here is the following: don't quickly sample->unsample/unsample->sample a port. Decide your instruments first, and then you can port it. If you want to do an alternate version of it, do it from scratch!

Said this, let's go forward.
You'll realise that the harder part when it's about sampled music is pretty much the sample's tuning.
The tuning of a sample defines its base pitch. It's defined in the last two bytes inside an #instruments definition.

SO ye, let's imagine we want to report SMB1 Castle theme but with external samples.
First thing to do is to decide which samples we need!
Looking at our MIDI, we need:
- A lead instrument
- A bass
- A percussion that does BUM
- A percussion that does TSS
- A percussion that does PEM

So ye, apparently we'll need just 5 samples.
For this demonstration, let's use the samples in this .brr submission by Masterlink.
As you can see, it contains a big amount of samples, all coming from Romancing SaGa 3. You can listen to how they sound by opening them with the .brr player tool I linked you on top of this chapter.

Let's decide which samples to pick!
- For the lead, I'll use "String Ensemble 1.brr";
- For the bass, I'll use "Synth Bass.brr";
- For the BUM, I'll use "Acoustic Bass Drum.brr";
- For the TSS, I'll use "Closed Hi-Hat.brr";
- For the PEM, I'll use "Acoustic Snare.brr".

Pick all 5 of them, and put them in a folder. Give this folder the name you like. I'll call it "VitorVilela".
Put the folder inside the folder "samples" in your AMK folder.

We're ready.
So, how do we do stuff now?
The first thing you have to do, is to tell to your .txt the path to follow for your samples and to load them in our port.
To do that, first we use #path "folder name" to tell the path, then we do #samples, opening curly brackets with our samples inside.

A common error: when you define external samples with #samples, you're pretty much replacing ALL the samples inside the port. Yes, even the SMW ones. That's why, before defining your samples, you must include the sample group of the SMW samples.
We have two groups for them:
- #default, which is the standard SMW samples group
- #optimized, which are the SMW samples with their size slightly reduced. This was made to give more space to ARAM.

For this example, let's decide to go with #default.

In my specific case, I do the following:

#amk 2
#path "VitorVilela"
"Acoustic Bass Drum.brr"
"Acoustic Snare.brr"
"Closed Hi-Hat.brr"
"String Ensemble 1.brr"
"Synth Bass.brr"

We're doing it good! We first defined the path folder "VitorVilela", and then we loaded our samples. First we load SMW's samples with #default, then the external ones.

Now we have to define their tuning and ADSR!
Luckily, we downloaded them from a .brr submission in the central, and a rule for these submissions is to include the ADSR and tuning.
Infact, if you look the .brr submission we used, there's a .txt called "Tuning (Full).txt" which contains the ADSR and tuning of all the samples in the pack. The .txt follows the same format you use for #instruments.

Let's just copypaste the ones we are using inside #instruments.

Our txt becomes like this:

#amk 2
#path "VitorVilela"
"Acoustic Bass Drum.brr"
"Acoustic Snare.brr"
"Closed Hi-Hat.brr"
"String Ensemble 1.brr"
"Synth Bass.brr"
"String Ensemble 1.brr" $ff $e0 $00 $02 $7d ;@30
"Synth Bass.brr" $ff $ee $00 $07 $84 ;@31
"Acoustic Bass Drum.brr" $ff $e0 $00 $07 $3a ;@32
"Closed Hi-Hat.brr" $ff $e0 $00 $08 $98 ;@33
"Acoustic Snare.brr" $ff $e0 $00 $07 $3a ;@34

Note the following:
- We don't need to redefine SMW samples' ADSR and tunings. That's automatically done.
- You don't need to keep the same order of samples you kept in #samples for #instruments.
- If you remember how #instruments work, "String Ensemble 1.brr" is @30, "Synth Bass.brr" is @31, and so on... Good porters generally keep track of the @XX value by writing it after the #instruments definition after a ;. Look how I did it to figure.
(The ";" starts a comment. All the stuff after ";" won't be seen by AMK).

Okay then, let's report the song and let's use the external samples we chose!
A possible input could be the following:

#amk 2
#path "VitorVilela"
"Acoustic Bass Drum.brr"
"Acoustic Snare.brr"
"Closed Hi-Hat.brr"
"String Ensemble 1.brr"
"Synth Bass.brr"
"String Ensemble 1.brr" $ff $e0 $00 $02 $7d ;@30
"Synth Bass.brr" $ff $ee $00 $07 $84 ;@31
"Acoustic Bass Drum.brr" $ff $e0 $00 $07 $3a ;@32
"Closed Hi-Hat.brr" $ff $e0 $00 $08 $98 ;@33
"Acoustic Snare.brr" $ff $e0 $00 $07 $3a ;@34

#0 w255 t37
@30 v200 o5 l32

@30 v200 o4 l32 y9

@31 $ed$1e$A5 o3 v255

v160 y10 @32c8
v180 y11 @33c8
v200 y10 @34c8
v160 y11 @33c8

v160 y10 @32c8
v180 y11 @33c8
v200 y10 @34c16c16
v160 y11 @33c16
v200 y10 @34c16

(don't get scared of the yXX if you didn't see them yet. yXX is the pan command. XX specifies the panning value.)

Output SPC
Mmmmmmm sounds okay!
Obviously, it doesn't sound that great because it's pretty simple. Imagine this when you'll add echo, when you'll do more panning trickery, and more. This could become a really good port!

Before ending this chapter, let's question this: what if we had no tuning? How to tune a sample?

This is, sadly, something that takes time to master. I took a whole lot to properly tune samples myself. I still remember when I used to annoy CrispyYoshi with my Suwako's theme lol. Those were good times...

Although, I can give you a tip from my own experience.
I recently found out that, when two different samples sound similar and play the same pitch, if you listen them with headphones, they make a sort of weird wave noise. The frequency of this wave noise tells you if the two samples are tuned in the same way or not.
If one of the samples you play is tuned correctly, then you can basically use it to tune the other one which isn't tuned!

The "universal" sample I use when I have to tune, is this one.
As soon as you open it, it plays a tuned C note (it's actually a few ticks flatter aka low pitched).
You can use this sample to tune all the other samples, since it's a good approximation of a C note!

Let's simulate such situation! Hopefully you'll figure hm?
Let's imagine we didn't have the tuning for "String Ensemble 1.brr".

Let's open both "UNIVERSAL C.brr" and "String Ensemble 1.brr" with the brr player.

If you hear them, they're not playing the same note! UNIVERSAL C is higher, while the string is lower in pitch.
What we do now is to increase the pitch of "String Ensemble 1.brr" so that it sound like UNIVERSAL C.

The elements you have to change inside the .brr player are the "MULTIPLIER" value, which is the 1st tuning value in #instruments, and "SUB.", which is the 2nd one.

Let's increase Multiplier by one value.

Woah! Now it sounds tuned already?!
As you can listen, the overall kinda makes a sort of wavy sound. This means that we're close to the perfect pitch.
You're free to increase/decrease the SUB. value until you feel like the two samples play at the exact pitch.
Once you found the Multiplier and Sub. values, take them and put them as the last two bytes of the line in #instruments. For example, if we found out that the sample is tuned at MULTIPLIER 05 and SUB. 00, we would write this:

"String Ensemble 1.brr" $FF$E0$00

I point out something now.
As you can see, the tuning value is different from the one we used in our SMB port.
In particular, it looks like we tuned our sample one octave higher!
If we want to find the value used in the SMB port, we have to redo the whole tuning thing, but with the UNIVERSAL C sample with one octave lower!

Now repeat the tuning process with String Ensembe 1.brr...

Okay so... multiplier 5 isn't good anymore. Let's go lower. Let's go until... hmmm... 2?
2 seems okay, but they still play different notes.
Now do the following: keep increasing the Sub. value.
Your reaction is explainable, lol, but yes. If you're around Sub. 70, they sound pretty close. If you put it around 79-7F, they sound almost the same, and you can hear some wave effect going in your head (if you have headphones).
If you look the tuning value we used in our port, you realise that we're extremly close to the perfect tuning!

So ye, that's how I tune nowadays, lol.
Obviously, if you have samples that approximate the C note better, you're free to use them instead of mine.
Before I discovered this UNIVERSAL C sample, I was used to tune with a virtual piano available on the internet.

With this, the chapter about external samples and tuning is over!
Later on, we'll learn how to rip one from a .wav, so... stay tuned LOL!


3.2. Ripping .brr files from external sources
It sounds like an .mp3 because it kinda IS an .mp3...

This chapter will show you how to rip samples from the following audio formats:
1) SPC
2) MP3/WAV/OGG/whatever

Let's analize the first case.


This case is pretty simple: imagine we want to rip the samples playing in this SPC.
This method uses a tool made by gocha called Split700. You can go here to get the last relase, but I'll be using an older version which does the basic job. Get it here.
This tool will automatically rip and loop all the playing samples of an SPC. Simply put the spc in a folder together with the .exe and the .bat. Once you'll double click on the bat, all the spcs contained in the folder will be processed, and their .brrs will be ripped and looped properly.
Do note that all the output .brrs will have this name format:
Watch out for the XX here: it tells you the sample number. To get the sample number, open your spc in spc700 player, press right arrow twice and you should get this.
The red circles show the sample number which is playing in that moment for each channel. The number appearing there is the XX number which identifies each sample.

Some notes of importance:
- A great number of .brrs outputted will be invalid (in most cases, from number 30 onwards).
- You'll be ripping ONLY the samples which are playing in the inputted SPC.
- This works for AMK ports as well, although, before ripping a sample, you should ask for the author's permission, since in some cases, SPCs can have samples made/ripped by the author of the port. All the laws of "stealing content" apply here, so if, for example, you submit a hack where a port is using a sample made from another user and you didn't ask for permission, the owner of the port has the rights to report to a staff, which means taking your hack down.

Believe it or not, this is the first method! Yep. End. Good.
Next method is funnier.


By "external resource" here I mean "anything that is audio". Yes, MP3, OGG, whatever, everything can become a sample for your port!

This method will make use of various tools.
- Audacity
- OpenMPT
- Either an addon called C700 here, OR snesbrr.

Okay let's start!
To prove you that we can rip anything with this method, in this tutorial, we're going to make a sample out of this .mp3 file.
Don't question the source, lol. Let's just say it's one of the most famous italian Youtube memes.

Our goal is to make a sample which does "EEEEEEE".
I'll divide the process in steps.

Drag and drop the .mp3 in Audacity. You should get this view.

The first thing we want to do is to identify what "sound" we want as sample.
In this case, we said we wanted the beginning "EEH!". Thus, we can erase the rest. Use your pointer to select all the stuff after the "EEH!" plays, and delete it with del simply.

Next thing to do is to make this mono. This is an important step: if you miss this, our .brr will play only on one side of the headphones.
Click this thingy and select "divide stereo in 2 mono" or something similar.

After you did, go to File -> Export Audio..., and save it.
Note that we now created a .wav file. Remember that from here, you MUST GET A .WAV FILE. Any other format won't be good from here onward.
Luckily, you can use Audacity for a whole lot of formats. I just used an .mp3, but other formats can be used as well.

Step 1 is done. My .wav is this one.

This is a very important step. Don't worry if you don't do good here: it takes time to master what it'll be explained here.

Drag the .wav you outputted previously on OpenMPT. Go in "Samples" and if you're using my .wav, you should get this screen.

From here, you can mess your .wav in various ways:
- You can cut parts in the black and red graph
- You can "downsample" it, which means to make it smaller in size
- You can loop it, so that it'll be usable as sample in SMW.

Let's do all these things.

The first thing I do is to remove the rest at the beginning: remember, your sample has to play almost instantly, as soon as you press play (the note icon). Don't make it too sudden, or you'll most likely hear some "clicking" when your sample will start with instant attack ADSR.
You can zoom in and out with the lenses to get the best accuracy.
Let's also remove the stuff after the "EEH!" in a more accurate way. Remember, the smaller your sample is, the better it will be for SMW's ARAM (Audio RAM, which is the space allocated by AMK for music)!

Next step, let's try downsampling.
Do note that you don't need to always downsample your .wav. If you manage to keep the frequency high, the sample's quality will be higher. Although, higher quality means bigger size.

For tutorial purpose, I'm gonna downsample.
To downsample, press the downsample button, tick "downsample", then press OK.
Your red graph in this moment became smaller. This means we downsampled it correctly!

Do note that, with the recent versions of OpenMPT, you can specify your own sample frequency. Higher frequency means high quality, the max the human hear can appreciate is 44100 Hz. The lower you go, the lower the quality will be.

Last thing to do, let's loop it so that it does like "EEEEeeee" forever.
Here too, note that this also isn't always needed: for example, if your sample is a percussion, you probably don't need to loop it, unless you want to do fancy stuff.

To loop it, just go to where "Loop" is, switch to on. If you try playing the sample, you're probably hearing like "EEEH!EEEH!EEEH!" lmao.

That's because yes, we looped it, but we must specify the start of the loop and its end.
To do so, adjust the values under where you set loop to on. Play the sample while you get the best starting and ending looping point, and make sure the loop point isn't recognizable by ear, or it'll sound bad.
This is pretty much the harder part (not making the loop point recognizable): it's not easy to get a clean loop point.
Some Wakana's suggestions:
- You could try using the "crossfade". In some cases, this makes the loop smoother, in others, it makes it worse.
- If your sample doesn't sound "clean", you could mask it once you'll use it in your port. Example can be adding echo, making a proper ADSR, or other stuff!

Once you found the right start/end of loop values, erase all the stuff after the end of loop point, since it'll never be played.

Once you finished, click on the blue floppy disk, and save the sample as .wav, give it a name, and you're done with this step!
My output is this.

All we have to do now is to convert the sample from .wav to .brr.
I'll explain various methods.


Open FL Studio, go to CHANNELS -> Add one -> More...
Scroll down until you see C700. Double click it and you should get this window.
Click "Load..." and choose your .wav file. In my case, I choose EEEEEEEE.wav.

It inserted.
Play it on C700's piano roll to hear how it sounds like.
If everything is good, click on "Save Smpl...", give it a name and save.

YOU JUST GOT YOUR .BRR! After tuning it and giving it an ADSR, it's ready to use!


You can do pretty much the same stuff you did for the previous case with FL Studio on OpenMPT.
So ya, once you have your .wav ready to be converted as .brr, do the following:
- Open OpenMPT and click "New".
- Go to "View->Plugin Manager", click "New Plugin" and search for the C700.dll file. Once you did, click on "Put in FX1"
- Now in "General", under Channel 1 Channel 2 Channel 3 Channel 4, there's "Plugins" with FX1:C700 selected. If you click edit, you'll get a similar window of this one.

From here, steps are the same ones as the previous case: click "Load...", choose your .wav, then click "Save Smpl...", give it a name and save.

Voilā, your .brr is created!

Thank you to TheJuanCarlos64 for this additional step. I wasn't aware of it, so thank you!


Before starting, know that the readme which comes with snesbrr explains everything I should do in this chapter. Reading it won't hurt.

Okay so, let's copy a command line (search for "cmd" on your operative system) inside the folder where snesbrr.exe and our .wav is.

Before we do anything else, MAKE SURE THAT YOUR START/END LOOP POINT VALUE IS A MULTIPLE OF 16. If it's not, your output sample won't be looped.

If you respected loop values, you can go ahead.

Open cmd.exe and write this:
snesbrr.exe -e *your wav name*.brr *your output .brr name*.brr --loop-start *your starting loop value here*

If everything went well, you got your looped .brr sample.
If not, then maybe your ending/starting loop values weren't multiple of 16. If this is the case, open your .wav with OpenMPT again, and do the proper fixes.

Yes, this is tedious and annoying. That's why I use the method with FL Studio, since it'll take care of the multiples of 16 thing automatically.

That's it!
Once you get your .brr, tune it correctly (like we saw in a previous chapter), give it an ADSR and you're ready to use it!
In my case, brr is this one. A possible use can be this one. (which makes me realize I should somehow let the yt guy know about this since I couldn't stop laughing).

Note that I used a silly example, although the process doesn't change with actual instruments like pianos, trumpets, and so on.

If you wish to go more in detail, in particular, you want to rip whole libraries of samples, you can check this tutorial I recently made.

That's all for ripping samples!


3.2.2 Making stereo samples
Surround me in your port LOL

This chapter was brought you by this user here! Big credit to him for letting me know such a smart thing exists!

So, we previously saw how to rip a sample from any external source, may it be wav, mp3, etc..
One of the steps we made is to make our source a mono audio (unless your source already is mono by itself). We did that because audio has generally 2 tracks inside it: the left speaker and the right speaker.
You can notice differences when you hear your source, then convert it to mono and listen to it again.

Let's make a tiny extension to what we said about ripping samples. In particular, we want to make our sample in a stereo way. Simply put, rather than making our source a mono, we'll rip both left and right speaker audio tracks and treat eahc of them as single sample.

Let's take back the lovely source we had for the previous tutorial here.
Let's open it on Audacity. This time, downsampling and cutting will be made here, in Audacity, so that you can make specular edits to our two audio tracks (the left and the right speaker).

Once you downsampled (bottom left of the Audacity window) and cutted the unnecessary parts (if needed), instead of clicking "divide stereo in 2 monos" you click "split stereo tracks" or something similar.
Your tracks will become from this to this. We divided the beginning block on its left and right components!
You're done! Click "export audio..." and save as .wav file.

In my case, I have this.

Now, open the .wav in OpenMPT.

If you switch this thing, you'll see that your .wav has 2 samples in it! These are, again, the left and the right speaker of your sample.
Switching both makes you see the differences between them: see the waves slightly change? This is made to create a stereo effect.

Let's rip it!
What you have to do here is to select "sample 1" and click on floppy disk to save the first sample, then select "sample 2" and click on floppy disk again to save the second sample.
We already cutted and downsampled in Audacity. I don't recommend to do it OpenMPT when you want to rip your sample in the stereo way, since in OpenMPT you work on the single sample, not on both of them at the same time like you do in Audacity.

That's it! You have 2 .wav files now, one for the left speaker and one for the right speaker.
Convert both of these in .brr with any of the methods we said in the previous chapter, and you're done!

Here is my result.

TheJuanCarlos64 made an example with the nintendo switch sample, listen it on all its majesty.

This is the power of stereo samples!

Of course, you'll have to include both .brr files in your .txt, as well as making them play in sync, or the stereo effect won't do its job.
This leads to 2 disadvantages mostly:
- This can be tricky in your .txt, since, in order to play a sample, you need 2 channels and not one.
- This takes double the space.

That's all for stereo samples.


4.1. SFX making
I ran out of ideas for a subtitle here lmao

Before starting, know that this chapter one day will become obsolete due to the newest version of AMK.
This chapter refers to AMK 1.5.

Okay so, this is something that's rarely done, which is... creating new SFXs in a hack.
In terms of theory, if you know the basics of porting, you'll know how to make an sfx as well. Although, you have to see it this way: SFX syntax is waaaayy more limited than in a normal port. For example, you can't define a direct ADSR, you aren't able to write almost all the hex commands, and so on.

(aka what's written in AMK)

- You can define basic notes, c c+ d d+ e f f+ g g+ b;
- You can define an octave with oX and change it quickly with > and <;
- You can save a note length with lXX (so that for example, l32 c16 r e >b8 is actually c16 r32 e32 > b8)
- @XX defines an instrument
- @XX,YY allows you to use noise. The noise's pitch (from 00 to 1F) is defined by YY;
- vXXX sets the volume. v0 is no volume, v127 is the max volume for SFX;
- The panning command (the yXX) doesn't exist in SFX. Instead, you do vXXX,YYY. XXX is left speaker's volume, YYY is right speaker's volume.
- You can make a pitch bend in 3 ways:
1) By using the & (for example, b8&g8)
2) By using $DD$WW$XX$YY$ZZ ($WW = starting note; $XX = delay; $YY = duration; $ZZ = final note).
3) By using $EB$XX$YY$ZZ, same as $DD but without specifying the starting note. This works like the pitch slide of normal ports.

AMK is smart, and it has two different instruments lists: one for normal ports, and one for SFX.
We already saw the former one in a previous chapter, now I'll describe the second one.
(Note: I'm unsure about some ADSR values. If you spot errors, let me know!)

SFX -> Equivalent of normal port (instrument number + ADSR + pitch)
@0 -> @6 $DF$E0 $02$00
@1 -> @0 $FE$0A $03$00
@2 -> @3 $FE$11 $03$00
@3 -> @4 $FE$6A $03$00
@4 -> @0 $FE$11 $03$00
@5 -> @8 $FE$6A $03$00
@6 -> @2 $FE$6A $06$00
@7 -> @6 $FE$6A $05$00
@8 -> @0 $CA$D7 $03$00
@9 -> @16 $0E$6A $04$00 (???)
@10 -> @11 $FE$6A $02$00
@11 -> @11 $FF$E0 $05$00
@12 -> @14 $FE$00 $06$00 (???)
@13 -> @0 $B6$30 $06$00
@14 -> @18 $0E$6A $03$00 (???)
@15 -> @1 $FA$6A $03$00
@16 -> @2 $FE$16 $03$00
@17 -> @19 $0E$16 $03$00 (???)
@18 -> @2 $FE$33 $03$00

AMK is comfy when it's about ports, because you can use the GUI in porter mode, and load music on the fly.
This can't be done with SFX. You'll have to test your SFX in-game.

A small wakatip I can give you to test it quicker is the following:
Go in the folder 1DFC of AMK, open 35 Jump.txt, comment evenrything it's written, and write your own SFX instead.
This way, as soon as you insert music in ROM and load it in an emulator, you'll hear the new SFX in the titlescreen directly, since it replaces Mario's jump sound.
You can also test it in any level, by jumping.

No worries: to revert back your Jump sound:
- delete the stuff you wrote after the commented stuff;
- uncomment what you commented before;
- insert in ROM, and your jump sound is back!

Comfy, no?

This is very easy: you want to add an SFX rather than replace any of the existing ones?
- first, choose where you want to play your sample, if in folder 1DF9 (which is channel #6) or in folder 1DFC (channel #7);
- add your new .txt in the folder you chose;
- now open addmusic_sound effects.txt and add your new sfx similarly to when you add a port: that is, by assigning a slot, followed by its name, file format included. Note that, depending on which folder you chose, you'll have to add it in the first list (SFX1DF9) or in the second list (SFX1DFC);
- insert music in your hack and you're done.

Small note, adding SFX affects ARAM. That is, if you add more SFX, you'll have less space for i.e. setting echo in your ports and inserting external samples.

The stuff I'm gonna say here is untested, as in... it works in theory, but AMK is unstable when it comes about SFX.

One of the things you can't do in SFX is adding a new ADSR. Yup, specifying an $ED$XY$ZQ does nothing in an SFX. There's a more complex-yet-not-too-awful process to do so.

Go in asm->InstrumentData.asm and scroll at the bottom.
You should be able to see a list which says "SFXInstrumentTable".
This is where the list I wrote up there is from, lol.
As you can see, the list follows simple criteria for adding a new instrument.
Keep in mind that the instruments to consider are the ones of the normal ports! (as in, from @0 to @29)

So ye, let's say we want to add this instrument: @2 $FF$F0$00$05$60
This is how you'd write it in #instruments. How do you write it here?
Simple. You can see the format yourself:

; Format: 9 bytes per sample instrument.
; Byte 0: Left volume
; Byte 1: Right volume
; Byte 2: Starting pitch 1
; Byte 3: Starting pitch 2
; Byte 4: Sample (SRCN) number
; Byte 5: ADSR 1 / GAIN
; Byte 6: ADSR 2
; Byte 7: GAIN
; Byte 8: Tuning

Knowing that:

- Sample number is @2, aka $02
- ADSR is $FF$F0
- Tuning is $05$00
- Always copypaste the first 4 bytes

We can add a new line at the bottom, in this way:
db $70, $70 $00, $10, $02, $FF, $F0, $00, $05

Once you made a new line, the new instrument will be specified with @19. We had till @18, so adding new ones will make them @19, @20, @21, etc...

Sometimes it'll happen that your SFX repeat themselves after they play once.
This is the most common bug when it's about SFX.
The basic fix is the following:
- Set volume to v0,0 once your SFX ended;
- Write $00 at the very end of your SFX.

This always worked for me. Hope it does for you too.

Aaand that's it I guess.
Sadly, I don't know A LOT about SFX, so some informations may be missing and some could be wrong. In case you experience an error, let me know, let's learn together and I'll fix the offending error.


4.2. SFX with external samples
I want IRL sound effects in my hack!

We're getting really in-depht with this chapter. Thanks to Torchkas, I figured a smart way to make SMW play an external sample without having it included in the global group of smw's samples.
If we wanted to do that (adding external .brrs as global samples), we had to say bye bye to ARAM space, since that'll take a lot of it, you'd barely have space for your other local songs.

I already did a tutorial of it. You can find it HERE!

Do note that, with AddmusicK 1.1, this chapter may change drastically. I personally didn't study how much SFX behavour changes yet, but ye, I'm just warning you. I'm including it for now, but know that one day, this could become obsolete.

So ye, check that thread I linked you.


9.9 Wakana's trickeroni of the maccheroni in ports
Watch me winning idol!

This chapter contains misc fancy effects I discovered during my porting experience.
If you have some, reply here, and I'll add yours and credit you.


This trick takes its name from my role model in porting, Izuna. Since the first time I see this I saw it from her, I nowadays call it like this.

Idea: replace all your rests with the last played note with a lower volume, to simulate a sort of echo effect.


#amk 2

@9 $FF$E0$00$03$00

#0 t50 @30 l16 v200

e q78 e q7f f q78 f q7f a e d q78 d q7f a e e b a q78 a q7f a e d q78 d q7f e 


This effect helps your port to be less empty.
Note that I used qXY. X defines how long the note plays (0 min, 7 max), and Y defines the volume difference (0 = no volume; f = normal volume, anything under f = lower volume)

PMW (or PWM I always confuse this)

This effect simulates the pulse modulation width effect.

Idea: make a copy of your channel, apply surround pan to the copy and make it slightly sharper with $EE$XX. Then, apply legato ($f4$01) to both channels.

#amk 2

@4 $FF$E0$00$03$00

#0 t65 @30 l16 v140

$f4$01 ;legato
y10,0,0 ;normal pan

<b8g2.. r8 g4.g+4g8f+8g8>c+8c8<
f8 c2^8 r8] (002)[c8d8d+4.d4d+8f8g8<b8.>c8.

#1 @30 v140

y10,1,1 ;surround pan
$f4$01 ;legato
$ee$04 ;making it slightly sharper
(003) ; copy of #0


You can set a different width of it by changing $EE$XX. Suggested range is 02-1F for unsampled.
This was discovered by RednGreen. Big thanks to him.

Better two-channels echo

I peeked this from other SNES games. It could work pretty good whenever you have a free channel and want to do this.

- simulate echo in another channel (so copy one of your channels in another, lower its volume and add a beginning rest note)
- apply some sharpness ($ee$XX) in the copy.
- reduce the Q value in ADSR so that the main channel ends earlier then the echo-y one.
- sometimes, surround tricks are also appreciated, but they're not mandatory.


#amk 2

@4 $FF$ED$00$03$00

#0 t65 @30 l16 v200

y10,0,0 ;normal pan

<b8g2.. r8 g4.g+4g8f+8g8>c+8c8<
f8 c2^8 r8] (002)[c8d8d+4.d4d+8f8g8<b8.>c8.

; reduced Q of original ADSR
; + lower volume
; + beginning rest (r8)

@30 $ed$7f$e8 r8 v130 y10
$ee$1A ;sharpness ++



Watch out to the $EE$XX values here. The higher you go, better it'll be, but don't exhaggerate or it'll come out detuned.

Normal to ticks note length converter
This was brought by this user here. Big thanks to him.
There's a different way of specifying note lengths in .mml. We always used the normal length way, but there's also the way of specifying ticks.

To specify a note length in ticks, you have to define the note, followed by = an equal sign.

Following, a table which contains normal note lengths and their version in ticks:

Note in ticks / normal note
c=192 / c1
c=96 / c2
c=48 / c4
c=24 / c8
c=12 / c16
c=6 / c32
c=3 / c64

c=128 / { c1 }
c=64 / { c2 }
c=32 / { c4 }
c=16 / { c8 }
c=8 / { c16 }
c=4 / { c32 }
c=2 / { c64 }

(more coming soon?)


Welp you beat me to it.

Seriously though, I'm really glad a porting tutorial, even if its a WIP, exists now, especially coming from someone as skilled as yourself. I'm especially looking forward to your section on ADSR since I have no clue what to do in that regard (seriously I just use the ADSR thread).

Music Submissions
Thank you. Something like this has been long overdue. I haven't read through it all yet, so if I find mistakes I'll immediately PM you! #tb{:j}
{} are called curly braces.
Haven't read everything, but amazing job!

Join the Munchette Gang.
Thanks for the kind words. I'm glad my efforts are appreciated.
Thanks Maxo for giving this a look.

Anyways, I updated it, adding the ADSR part. The rest of the tutorial parts I want to add should be faster to write, so expect like 3-4 updates to finish.
Thank you.
A few questions.

-Isn't the $ED command kinda useless (minus faking GAIN for rare instances within a port) since #instruments exists?
-I know you said you don't use it much, but would you be willing to explain $F5? The AddmusicK readme says very little about it.
-I've found the most difficult command to use thus far is $DD, given that sometimes the notes you want to bend to are not included in the MML file which results in a lot of trial and error for those like me who suck at MML. Is there an easy way to determine the value at which to bend to?
-I'm also kinda stuck on $EF and $F1 a little, especially when trying to make @9 not sound awful. Would be willing to go into detail on that and how to set the first byte in $EF in a way that allows you to disable echo on certain channels?

Music Submissions
Originally posted by Decoy Blimp
A few questions.

-Isn't the $ED command kinda useless (minus faking GAIN for rare instances within a port) since #instruments exists?

Not really, there are advantages and disadvantages.

$ED is useful when you want to use a specific instrument in a speficic ADSR very little times. Plus, as I said in the tutorial, you can define $ED inbetween notes. Something like
@1 c8c8a8e8e16 $ed$7F$f5 c8c8e8a8r16d32c32 $ed$4A$e5 e8c8a8r1c16
In this case, we're using @1 with 3 different ADSR: the first block uses its default values, on second it uses $ed$7F$f5, and on third, $ed$4A$e5.

If you wanted to do the same with #instruments (imagine you need those adsr only once), it would've been a waste, since (afaik!) defining stuff in #instruments costs more than just doing @XX $ed$xy$zq.

But yes, your observation is right. Using #instruments is in most cases the best thing to do.

Originally posted by Decoy Blimp
-I know you said you don't use it much, but would you be willing to explain $F5? The AddmusicK readme says very little about it.
-I'm also kinda stuck on $EF and $F1 a little, especially when trying to make @9 not sound awful. Would be willing to go into detail on that and how to set the first byte in $EF in a way that allows you to disable echo on certain channels?

Both these topics regard echo, which I'll be talking about once I progress with the updates of the main post.
If you can't wait, you can check this excellent tutorial about echo and fir filter by Brozilla. It's very well done and it explains everything you have to know, but it uses lots of specific terms. I don't know what the reaction of newbies would be to that.

Originally posted by Decoy Blimp
-I've found the most difficult command to use thus far is $DD, given that sometimes the notes you want to bend to are not included in the MML file which results in a lot of trial and error for those like me who suck at MML. Is there an easy way to determine the value at which to bend to?

I won't hide that I also trial and error on $DD, but sure thing, I could give some in-depht suggestions on how to make it less painful to use.
What does ADSR stand for? Isn't there a meaning at all? Just curious.

And I never knew porting was this complicated. I thought it was easier than ASM

Your layout has been removed.
Originally posted by MasterSkodwarde
What does ADSR stand for? Isn't there a meaning at all? Just curious.

ADSR = Attack (rise in volume), Delay (first decrease in volume), Sustain (fraction to how much D should decrease), Release (final decrease in volume).

Yay, first layout!
Originally posted by Decoy Blimp
-I've found the most difficult command to use thus far is $DD, given that sometimes the notes you want to bend to are not included in the MML file which results in a lot of trial and error for those like me who suck at MML. Is there an easy way to determine the value at which to bend to?

you can use notes instead of hex values. for example, $DD $18 $18 o3a or $DD $00 $30 g

you can't use < or > for it, but that's not a super constricting limitation

(also bear in mind that $DD goes after the note you want to bend, not before)
Originally posted by MercuryPenny
you can't use < or > for it, but that's not a super constricting limitation


c8$dd$01$20>c ^1 --> *click*
c4$dd$01$20>>c ^1 --> *click*
o2 c2$dd$01$20>>>b ^4 ^2$dd$01$20<<d+ --> *click*
Originally posted by Wakana
"chorded percussions"

Great tutorial! The way you formatted it with bold and colorful text makes it very clear to understand. Also sample screenshots and spcs... I can definitely see the effort you put in here!

The way you explained about ADSR though, while understandable, I think it's kind of confusing. I can see where you're coming from tho, trying to make it as simple as possible since it's so extensive. I'm not asking you to change anything, but maybe add a little "summary" at the end of this chapter, to clear things up a bit.
I do appreciate though, the way you're approaching things and I can see the difficult in it, while fine-tuning and adsr are mostly musician specific knowledge, you managed to keep it understandable for the ones not so familiar with it!

Good job there.
Well, i havent really read on too much (planning to when I actually make a MML , tho), but are you planning on touching more on note length shit, like triplets and double notes? I was always really curious to know how does AMK handle those, and i'm pretty sure a lot of people wanting to get into porting would think that as handy enough information (myself included). lol

Either way, great job on finally making a music tooteral (someone may or may not understand that reference)! I'll definitely use this for reference, and maybe finally start doing stuff by scratch now that I actually have a reference this time around. #smw{:TUP:}
Layout by Mathos
I'm not asking you to change anything, but maybe add a little "summary" at the end of this chapter, to clear things up a bit.

Sure thing, will try.
Thanks for the kind words too!

are you planning on touching more on note length shit, like triplets and double notes? I was always really curious to know how does AMK handle those, and i'm pretty sure a lot of people wanting to get into porting would think that as handy enough information (myself included). lol

I could make a small chapter going a bit in-depht on triplets and how to handle them in FL Studio (with a trick a friend of mine recently told me).
What do you mean by "double notes"? You meant chords? I believe I did a basic explaination on how to behave, that is, to split a chord in more channels of the .txt.
Example: you have a chord of 4 notes? You'll need 4 channels, each one playing one of the notes of it, if you want to recreate it prefectly.

Pratical example: let's port this.

#amk 2
#0 w200 t50
@4 v140 o4
b2^8 >c4.

@4 v140 o4

@4 v140 o4

@4 v140 o4

Reply again if this wasn't what you asked.
Originally posted by Wakana
What do you mean by "double notes"? You meant chords?

Well, not exactly. I'm not sure how that's called, but what I mean is when there's two or more notes stuck together in one note. Not sure if they are chords tho, since in some situations they are, while in some of them they arent. Again, not sure. lol
Layout by Mathos
Originally posted by Ultima
Well, not exactly. I'm not sure how that's called, but what I mean is when there's two or more notes stuck together in one note. Not sure if they are chords tho, since in some situations they are, while in some of them they arent. Again, not sure. lol

You mean something like this?
You could choose either to port it like this or just increase volumes when the overlapped notes play (so in the example something like v150 a4 v200 ^4 v150 ^8 v200 ^8 v150 ^16 v200 ^16 v150 ^8 would work).
Depends on cases.

I still feel like I didn't get what you meant tho...
Originally posted by Wakana
Originally posted by Ultima
Well, not exactly. I'm not sure how that's called, but what I mean is when there's two or more notes stuck together in one note. Not sure if they are chords tho, since in some situations they are, while in some of them they arent. Again, not sure. lol

You mean something like this?
You could choose either to port it like this or just increase volumes when the overlapped notes play (so in the example something like v150 a4 v200 ^4 v150 ^8 v200 ^8 v150 ^16 v200 ^16 v150 ^8 would work).
Depends on cases.

I still feel like I didn't get what you meant tho...

IIRC, something like this:

Really tho, its my fault that I havent explained it well, since I cant quite know how to explain something when I dont know what is the thing I want to talk to in the first place (and that happens A LOT in my case, so) lol
Layout by Mathos
Not sure what does "double" even have to do with that, but I think Ultima's talking about legato. (First time is without legato, second time is with legato.)
Done with grammarizing everything up to 1.2.
Also learned how to port during that, oops.

Your layout has been removed.
Pages: « 1 2 3 »
Forum Index - SMW Hacking - SMW Hacking Help - Tutorials - Wakana's Music Porting Tutorial - From the Basics to the Advanced

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us

Total queries: 23


Follow Us On

  • Facebook
  • Twitter
  • YouTube


  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • MFGG
  • Gaming Reinvented