MMR Music Adding and Creation Instructions - isghj5/mm-rando GitHub Wiki
Adding new music to MMR is now easy: just drag and drop ZSEQ and MMRS music files into your Resources/music folder and MMR will automatically find and use them. You do NOT need to unpack MMRS files, treat them as a regular file and leave them intact.
Making new MMR music is much more involved: This is my attempt to document my own method, which might not be the most optimal, and in the future faster/easier methods might be available.
A lot of info regarding zSequence and bank creation can be gleaned from this instruction video from Hylian Modders: https://www.youtube.com/watch?v=_DwqyDw6kHk
As of Sept/2020 Majora's Mask's game engine can only play two kinds of music: streamed ADPCM music and sequenced zSequence(.zseq) files. Considering the entire n64 MM rom is only 32MB, and the average Bandcamp mp3 music album is larger than that, ADPCM (compressed AIFF) is somewhere between MP3 and WAV, using streaming music is considered unacceptable (N64 emulators might take 256mb roms in theory, but most carts are locked to 64). zSequence is Nintendo's proprietary sequence format which is mostly compatible with MIDI, and one can be converted into the other with minimal data loss.
The tool we use to convert MIDI to zSequence is Seq64, a tool that lets us rip/inject sequence files from several N64 games, including Zelda64. Seq64 also allows us to convert midi to zseq and visa versa, and the zseq files are usable by the randomizer. (A link to download is provided below)
The basic workflow follows:
- Start by creating(or convert) a MIDI in a MIDI editor program
1a) add a loop point if it's not naturally looping - import into seq64, finish looping
- inject into the MM rom to test/tweak,
3a) create a custom instrument set if needed, to match the sequence - Save the file as a ZSEQ
- Pack/Name the file so that it is readable by the randomizer
(alternatively, once you learn custom instrument set creation I usually make the song first, but make the custom set before I export the midi, so I can set the instruments in FL Studio instead of Seq64)
There are several limitations to converting MIDI music to Zelda64:
Limited Instruments
As of Nov/2020 it is difficult to inject new instrument samples into Zelda64, possible but not easy. We are limited by the available instruments already in the game, no theramin, no panflute, no finger snapping or clapping percussion, ect. Sometimes you can find alternative instruments that still sound good, depends on the song. In my opinion, any song that relies on basic orchestrated instruments translates easier than atmospheric songs that relies on very specific tuned instrument samples to sound good.
The ability to inject new instrument samples to make new instruments is available in 1.13, several instruments have been ported from OOT, completely new instruments is still not available (soundtool ruins most samples, because of bad adpcm predictor approximation).
Limited Instrument channels
Seq64 will only read a maximum of 16 instrument channels from a midi, and if your midi has more channels seq64 will attempt to load the midi without those channels and fail to tell you it dropped those instruments out of the file, so make sure you are under that threshold before importing.
Limited Banks
Each sequence song used by the game is allowed to use one and only one instrument set, containing all the music instruments that song needs to play. The randomizer can now read custom instrument sets with songs, but it requires extra work, and because it overwrites the old instrument set, it introduces a compatibility issue. This is a hindrance because each bank only has 1-15 instruments and sometimes a percussion kit, there are only 37 banks in total.
Edit: The ability to use two or more instrument sets has been discovered but not fully explored and not easy to use, for now you only have one to work with.
Vanilla bank information:
You can identify what instruments exist in which bank by using our instrument reference: https://github.com/isghj5/mm-rando/wiki/MM-Vanilla-Instrument-Reference#bank-0x03-general-orchestral--termina-field
Here you can see which vanilla songs use these banks: https://sites.google.com/site/deathbasketslair/zelda/majoras-mask/instrument-sets-and-sequences
Requirements
You will need the following:
- a USA (U0) N64 Majora's Mask rom to use as a testing rom (listening and fixing/tweaking),
- a rom decompressor (seq64 cannot decompress yaz0 files) (a link to nDEC is provided below),
- a MM sound font (or N64-Tools to rip your own, and a soundfont editor to convert to sf2),
- a MIDI editor (if it cannot add loop markers, you'll need a second one for that function),
- Seq64, which converts midi to zseq and back, found here: https://github.com/sauraen/seq64
- an Emulator or hardware that can play MM rom (to listen, for testing/adjusting)
- if you need custom instrument sets, you need my audiobank ripper script (https://github.com/isghj5/mm_audiobank_ripper)
To create a testing rom, which allows you to inject your music into a rom with seq64 that you can listen directly, you need to decompress your regular MM U 1.0 rom. The only program I know of that correctly decompresses MM and not just OOT is nDEC, which is command line only, you need to run it as a command in a terminal with "./ndec.exe path to/your mm rom.z64 majora_decompressed.z64 \clean". Alternatively, you can move your rom to the same folder, rename it to "input.z64" and double click the bat file that comes with the nDEC download below.
nDEC: https://mega.nz/file/2CxVmJSJ#wOxj6oJs2UCMgZh-2UQnLVJXDbwJAUKM3QUboEehmC0
Step 1: Converting/Creating MIDI
You need a MIDI editor or DAW (full music suite program) that does the following:
- Accept MIDI imports. Even if you only intend to create music from scratch, you might want to take tracks/samples for reference from already existing data to assist in creation.
- Accurate MIDI export. Any editor that destroys/corrupts the midi data should be avoided (looking at you LMMS, how is your MIDI export that bad).
- The ability to use SF2/DLS Soundfonts for playback. The editor needs to let you preview what the music sounds like before you go through the effort of adding it to the game. This is a time saver, and priority for quality of life.
- Easy modification of Events. MIDI allows for programmable changes to almost everything, normally found in a track of events that describe changes to make to a single channel at a given time. For instance, you can lower or raise the volume of all notes one instrument makes by using the automation for volume, or change the speed of all instruments by using the automation for tempo. If modifying automations is tedious or difficult, it’s not worth using the software. This is MEGA important if you want to convert MIDI, rather than create from scratch, as most midi you will find are loaded with automations that you need to modify or erase.
- Allows you to listen to a reference copy/samples in a different music player (looking at you JACK). The ability to listen to reference music at the same time as your editor can play the song. This is extra important for music converting, especially because after working on one song for a long time can skew your "sense of smell" and prevent you from finding flaws with your music. This is probably not as big of an issue for you as it was for me, but JACK based DAWs can mess with system audio, causing my music player to stop working so I had to juggle the two, not fun or worth it.
I ended up using Fruity Loops Studio 12 (FLS 12) because all the other programs I found were missing one or more requirements, but any editor that has the above should be fine. All of my examples of modifications will use FLS12 because it’s what I know, but I'm sure most MIDI software has similar features and can be used.
In order to listen to a close approximation of what your midi will sound like, you need to find a Majora's mask sound font. You can find one created by DezZival on the Hylian Modding discord and website. There are at least two others available through a quick google but I haven't checked how accurate they are.
You can rip them straight from the game with N64-Tools Soundbank tool... but those are incomplete. The envelopes are dropped for some instruments, and so you'll hear samples without their adjustments. This is good and bad, it allows you to tweak those samples in your DAW, which is very useful for making custom instruments for custom instrumnet sets if you want to dabble with that later, but its more work and converting a DAW setting by hand in seq64 sucks. These tweaks are not small, glass pad sounds completely different with the effects placed on it by the two separate envelope in bank MM:0x16.
Some soundfonts ripped from Soundbank tool like to crash FLS, this is because for some reason they rip without the last instrument sample loop end offset, you can look up this information in seq64 and then manually add it to the soundfont to fix.
Beginning with midi Creation/tweaking/correction
Load your midi into your editor, In FLS, a new MIDI will start with 100% volume, which is wrong, if you set it to 50% it will have roughly equal volume to in-game, if you adjust for volume at 100% it will be too quiet in-game.
Now you need to then assign each channel of your midi to a MM instrument. In FLS this is as simple as taking your MM soundfont files and draging them from the filesystem onto your FLS channel boxes, or onto a channel in the Channelrack (just don't miss it opens a new channel). The MM soundfont linked has both an ALL.sf2 which should include all instruments in the game (except banks 00-2 those are special and should be ripped) and individual banks with only the instruments found in those banks, I typically use ALL when I'm exploring what a song might soundlike, because it shows me almost all available instruments, and I can switch between them faster than switching banks.
images/fls soundfont application.png
If you are using a DLS soundfont, I can't help you. I only use SF2 soundfonts and they work on FLS 12 or 20, to convert a dls style soundfont I use a free windows program called Vienna.
Which instrument to choose per channel is up to you, the converter/creator. If you are converting music, this can be a guessing game with some instruments. Some MIDIs come with instrument names; if the MIDI was handmade by someone the instrument names might be semi-accurate, if the MIDI was ripped from a game however the MIDI will be assigned a number matching what was used in-game, which will not match your computer soundfont and those instrument names can be ignored. In general, any channel that uses only one note for the whole instrument (c5 hit over and over and over) is a percussion instrument, many percussion instruments can be merged into one channel for a percussion kit, splitting those big channels can be useful to visually sorting which notes use which percussion, and if you make a custom bank for multiple percussion kits (some songs want more than is found in one vanilla MM kit) then splitting makes it so you can assign them later.
There is no perfect way to convert most songs to MM because the instruments are different, even standard instruments like piano/guitar/piccolo will sound different because of tuning and sample recording methodology. Sometimes you will have to just try different instruments until you find one that sounds good, even if it's not in the spirit of the original song or matches the mood. IMO, the goal is to convert music so that sounds good, quality of the music end product is the priority, instrument accuracy (faithfulness) to the original or to MM's theme/feel should come second.
Note regarding n64 compatibility: The MM audio engine only supports 16 channels that can play 4 notes maximum each at a given time (64 total). If you try to play a fifth note one of the previous notes will be killed to start the 5th note. When converting music its important to remember that this limitation does NOT exist for your midi player, and does not exist for many other game consoles, so you will sometimes find music that was made without this kind of restriction, it will sound fine in your midi player, but will sound like garbage when injected into a MM rom. Look in the seq64 console for "Note out of order" errors to catch these if you hear issues with your songs. Seq64 1.5 will even straight up tell you that you have more than 4 notes on at a time.
Also sound effects share these channels with the music, if you have spare channels you might want to avoid using more than 3 notes per channel for Background music, and 2 per channel for combat/boss music, as the sound effects can clip the notes just as notes can clip other notes. You can mitigate this a bit by setting the song channel priority higher, but that's extra work. In Zorahall, the waterfall sfx often cuts out instrument notes, and CTD2 rain+ambient sfx.
Known seq64 MIDI to zseq conversion bug:
Seq64 does NOT support stacking notes or notes within notes, this is not a MIDI limitation but a seq64 bug, as there are many games that might stack notes inside of each other for audio effect or start another note before finshing the previous one, but as seq64 does not support this, we have to avoid it manually.
If you leave these notes intact, typically, the song will slowly lose notes as the song plays until the instrument dies. Check your seq64 console output after a MIDI import it should be throwing errors during the channel reading portion if either of these notes are found. You will also see, in the debug console for Seq64, errors pop up when you import the midi saying "Note off (info) recieved for note that is not on!"
If converting music: A lot of MIDIs come with mixed percussion tracks that will match the percussion kit it was designed for, and does not match MM’s percussion kits. You will likely have to shift certain drums (up or down notes) to match the correct notes/samples needed to play those instruments, like moving crash several notes down, moving shaker up, and moving timpani/kick (Timpani is in the Upper samples of orchestra, not lower). Sometimes these channels should be broken into separated channels for visual aid or for channel pan adjustments (some songs require hats more in one ear than other, same with kick drum, can’t choose the pan of one drum unless they are on different channels, or you get crazy with the pan automations, but if its always one or the other, just separate them). In FLS you can select all notes that use the same key by selecting the key with the select tool in piano roll, in addition to drag box selection.
If converting music: A lot of midis will contain a copied loop of the song for the purpose of making it longer for listening purposes. Leaving these in the song will not change how the song sounds in-game, but will result in a larger file, later down the road we might have space problems (although it is already believed by some that large files cause some issues). I typically cut these out to what I think is the smallest size needed, usually after shuffling the song all the way over to the left and cutting along the bar end, such that no notes are cut in half. Sometimes this is really easy and obvious, sometimes it's hard to find the right spot to cut, but if your song is still under 0x2000 without needing to do this, it might be more prudent to set that aside for later when this guide isn't necessary anymore. In FLS12 I cut by selecting the region based on the bar in piano roll, starting from the cut expanding far to the right, selecting a different channel and hitting delete should delete all notes after the cut for that one channel, continue for all channels. If midi doesn't shrink, there are hidden automations that linger that you will have to remove, often on pan/pitch or volume.
If converting music: Some MIDIs were made using instruments with samples that had different tuning, as a result when you attempt to assign a MM instrument similar to what the midi wants, you'll find it plays at an octave too high or low. In FLS12 you can select all notes in piano roll (CTRL-A for all) and hit CTRL-"up arrow" to make all notes raise an octave, and lower is the down arrow. Sometimes you want to change the tuning anyway, piano and a few other instruments change their nature a bit as they drop octave, it can be weird hearing one note play in a different octave from the rest as it uses a different sample and sounds out of place. This is because each instrument in midi is just a collection of instrument samples that are pitch-stretched between each other, and the lowest piano sample is very different from the middle sample in the MM piano.
If converting music: Some BGM MIDIs come with all variations of that BGM mixed into each other, (eg Luigi's mansion, where whistle, humming, exterior harp, and girl playing piano are all mixed in, or Banjo Tooie levels(40+ channels)) and the game chooses which to play by muting certain channels. You might not need these channels, and they can confuse you when those channels are used at different times, mixed they will be confusing.
If converting music: Some MIDIs will come with a gap at the front which needs to be removed. In FLS12 you can cut space from each channel by selecting the exact space in the piano roll by right-click-and-dragging from the start to the cut spot, and then hitting CTRL-Delete to cut that space. HOWEVER, this does NOT delete the automations, so you'll want to make sure you delete the same exact space from the automations for that track or you'll have pitch mods at the wrong spots, instruments fading too late, panning out of sync, ect. I wish I had a solution where you could cut the front from ALL of it, but I don't know how.
If converting music: some MIDI's will use really short notes under the assumption that the length of the instrument sample is static and cannot change, and only a sliver of a note is required in the original midi to play the whole note, but in MM, those notes are limited to the length of the note in the midi, so we need to extend the notes for it to sound good. Kick drum and Timpani are especially bad at this and often sound bad because they are cut off early. With drums, its easy to select instrument by note and drag from the right to extend the size for all notes. Just make sure the magnet is set to the smallest increment because you want the control to set exact lengths. Unfortunately, sometimes this extends the drum length over the bar end and you need to extend the song a few bars or use a shortened note which sounds off.
If converting music: Some MIDIs will come with a lot of locking events: often there is one pan automation at the very start of the song locking the instrument into using one pan. Sometimes there is one on volume too, even one on tempo. These one-off automations are annoying, they will not allow you to tweak the knobs for tuning your music, you can either remove them all and re-add them back before using the convert to midi macro, or get used to changing them after every knob tweak by opening the events automation and hitting ctrl-i to set the automation to match the knob. In FLS12, you can look at the automation for volume by either right clicking on the volume knob for that channel in the channel rack and selecting "Edit events", or opening the channel instrument panel and right clicking the volume knob there. It should open or swap the Events panel to the volume for the channel you want to look at. Similar steps will show you automation for pan (if it’s a thin green line: it’s a lock on center pan).
Warning: FLS12 has an auto limiter, if you're having trouble hearing some instruments at max channel volume, it might be because the overall volume from too many instruments is loud enough to quiet the whole song, and since the game doesn't have a limiter, it might be waaaaay too loud. If it is still too quiet in-game, you can instead lower the volume of every other instrument, and raise the master volume.
Once your midi sounds good, and you're sure you have an audiobank it fits into, save and export the midi with changes. In FLS12 you have to convert the project for midi export, go to the top Tools->Macros->Prepare for MIDI Export.
images/fls prepare for midi export script.jpg
This export macro will dump all soundfont info, it will also reset channel numbers for all channels. You can set your instruments so that they will be properly assigned in seq64 later just add 1 to each instrument value compared to the bank reference (flute? 0? leave as 1. strings? (a is 10)+ 1 = 11. FLS12 have a tendency to drop volume info from the channels to, unless you add automations back in where you removed them. CTRL-i auto sets a flat automation in the events window. If you set the master volume to 50%, you're automations will normally have good sound volume in MM as they do in FLS.
Exporting Note: Percussion kit for the audio bank is the last midi channel which is 127, or 0x7F in hex. 7F is what you want to use as the channel for percussion channels in Seq64. FLS (and some other midi editors) instrument assignments index start at 1, however, so you need to set them to 128 if your editor starts counting at 1 (midi standard) instead of 0 (programming/computer standard).
images/fls export instrument change.jpg
Exporting Note: The names of the instruments in your MIDI editor/DAW are irrelevant to Majora's Mask, those names are the names of the instruments in your editor's default soundfont, or Windows' default soundfont, Majora's mask instruments are determined by the instrument set instead. The last midi channel is sometimes called "Gunshot" but this is irrelevant to Majora, the numbers are what is most important and what you should focus on (unless your MIDI editor/DAW doesn't show those, which is weird)
Program changes
If you have a channel that needs to play two+ instruments at different times, this is called a "Program Change" in midi terminology and if they exist in your MIDI file, seq64 and MM will support it.
If your midi editor doesn't support, or makes it hard to add, program changes to a channel, you can add them in sekaiju before looping.
To add a program change in sekaiju, load your midi into sekaiju, then right click on the channel that you want to add a program change to, and select "Show this track's Event list window" to open a window that has all events for that channel.
images/sekaiju_access_track_events.png
Once this new window opens, you want to scroll down the list of events until you find the nearest event to the time you need to add the program chance, select the nearest event before the event you want to add, and click on it to select it (1), then press the Inset Event
button (2) to add a new event, although the even will need to be edited further. You need to open the "event kind" field's drop down list and change it to "Program change" (3), then change the instrument to the instrument number that will match the instrument you want in-game(4). Also make sure the exact measure and/or time for the event is at the right spot (5).
images/sekaiju_add_program_change_event.png
(Technically, we now know the game engine can support playing two separate instruments at the same time, one instrument per layer, but seq64 does not support this right now)
Step 2: Looping
If your midi is naturally looping, where it goes back to the very start as soon as it finishes, you don't need to add a loop marker. If your midi has a separate introduction section that should not be looped, then we need to add a loop marker where the song continues after it reaches the end. You can identify where the song should loop in FLS12 finding the Piano roll view, right-click-dragging a red section (in the black bar at the top) between the end and your loop point to set a looping section in the piano roll, and listening to the roll cycle through the loop. FLS12 doesn't have the option to add a loop point so I need a second midi editor to add a loop point, I use Sekaiju but Zoey uses AnvilStudio and its more advanced and better software for editing, but I find Sekaiju faster if using it for just adding loop markers.
Open your midi in Sekaiju, right-click on the bar right above the bar count, where blue letters display the timing of the midi, and select "Insert Marker", add a name ("Section 1" works but some marker names wont be detected by seq64) and make sure the timer is set to the exact location of where the song loop resets.
Issue: Do not split notes with a loop marker
Seq64 has a design flaw where if you place a loop marker across an existing note Seq64 will separate the start and end of the note and possibly break the whole song, make sure the loop marker will be placed in a spot between notes to avoid this. One of the symptoms of this is an instrument will slowly start dying, losing more and more notes until all notes are gone, and will reset back to working instrument only after it loops. Sometimes you can get around this by just extending the song a bit so that the loop marker fits in a different spot, sometimes you have to remove an echoing channel or shorten a note and re-lengthen it again after seq64.
images/seq64_note_off_error.jpg
Note: MIDI timing index starts at 1, so very start of the song is 1:01, not 0:0, and if the bars are separated by fourths, then the fourth bar is actually 1:04 because we started at 1:01. Keep this in mind when setting the loop point. However, while the midi bar and quarter bar start at 1, the parts per quarter bar start at 0 (0-95 standard MIDI, 0-47 in zSequence) so the very start of your song is not 1:01:01 but really 1:01:00
Step 3: Converting to zseq
Now it's time for seq64. This program is a bit unintuitive to use, there are a lot of features we don't need, so I'll explain the exact steps you need to take. But first, if you intend to load the zseq into a game to make sure it sounds fine, which you should, you need to decompress your MM rom to 64MB or you cannot inject sequences into MM with seq64. There are several programs for decompressing OOT roms, but if you try to use them on MM some of them will fail. (one of them will make start button crash). The one I know works is NDEC. A link was posted up at the pre-req part of this guide.
Load the MM Romdesc
In Seq64, you have to load a description file that contains all the details relevant to the type of rom you are using, in this case Majora's Mask. This is an XML file that comes with the seq64 program and is located in the romdesc folder of your seq64 location. Load it with RomDesc->Load...
The version that comes with Seq64 is old, I've fixed and added more content to my version which can be found in the audiobank guide, in the sidebar. The MMR discord has modified the romdesc file dozens of times, go there to find the most up-to-date.
Now load your decompressed MM into the program with ROM->Load...
Load your Midi into seq64
Switch to the Midi tab and import your MIDI with the purple Import MIDI button in the top left. Switch to the Audioseq tab and you should see data in the middle under "Loaded Sequence" which means seq64 has already converted your midi to zSequence.
Really big MIDIs can take awhile for seq64 to convert, seq64 should have a console window and you can see it working in there if you want to see visible proof its not frozen when the GUI stops responding.
Pointing the end song branch at your loop
If your song is not naturally looping, and you added a loop marker, you need to align this marker in the zSequence header. In the Loaded Sequence window, select the Seq section, which is the header, on the right you should see two bunches of "Absolute Chn Ptr commands". You should also see a "Branch Abs Always" command at the bottom of the header. You need to change the value of the branch to the first command of the second section of absolute Chn Ptrs in order for the song to branch to that location, where it’s normally set to the address of the first section, which loops the whole song.
Shortening the sequence to match the song length
If your song does not end at the end of a MIDI bar, seq64 will make the song play until the end of the bar and there will be a gap at the end of your song, which is especially bad if you want your song to loop. You will need to shorten the song by changing the song length. In the Sequence Header section, you should see at least one "Timestamp" command near the bottom, right before the "Branch Abs Always" This describes the gap between the last big marker and the end of the song, and if you shorten it you will shorten the song. How much needs to be removed depends on where the song ends relative to the bar, Zelda sequences use a bar that is 48 parts long per quarter bar, which is 192 per bar, or 0xC0 in hexadecimal. That makes a quarter bar 0x30 in hex, and an eighth of a bar 0x18. You can choose any length in increments of 0x01 but it's rare to need song lengths that unique.
Alternatively, you can shorten the end of the song in sekaiju by moving the End of Track events, but man, you'll have to ask darkychao if you want help with that it makes no sense to me ¯\(ツ)/¯
Changing the instrument a channel uses
If you didn't assign instruments at midi export, you will need to assign them now. Select the first Chn item in the Loaded Sequence window and on the right a list of commands should show, one of these is the instrument command, select it with your mouse and in the bottom right of the page you should see a Value: text box. Insert the hex value of the instrument in the audio bank you are using here. Do this for every Chn section in the loaded sequence.
When you loop a song in midi you add a second channel header for the song after the song loops. Some midi editors will add a second instrument command at the loop channel, which changes the instrument after the loop but by default it just re-sets the same instrument already used. This is a second instrument you will need to modify or delete if you don't want the instrument to change, otherwise your song will change instruments after the loop.
Setting up a testing song slot
We need to test our new music in-game to make sure there are no issues. We can use seq64 to inject our song into a testing ROM without MMR.
(We could use MMR instead: If you add songtest
to the filename of a song MMR will always force it into file select every seed, if you do have an issue that takes longer to export->rename->regenerate seed, directly injecting into a test ROM should be faster, especially later if you want to use a custom instrument set. Switch to the Files tab at the top.)
In Seq64, in the Files
tab, in the top left under "Known Files", select the "Audioseq Index" entry and you will see every song in the game in order loaded on the left column.
The two best song slots for testing music in MM are the first two screens you can reach at the start: Title Screen and File select. File select is a bit better because although it requires input it does not timeout, you can listen to very long songs loop multiple times without the cutscene ending like title screen. However, both of these slots are kinda small, you want a song slot that is big enough for any song you want to test, so we need to make the slot bigger. The fastest and easiest way to do this is to pointerize the credits song slot, it's a test rom so we don't need to hear the credits music, and its a huge song that takes a lot of space, you can make your test song slot any size you want with that much extra space after removing it.
Overview of making a testing song slot:
- Destroy/Pointerize end credits to free up space
- Select File Select then change the Make Room value to something big enough to fit the sequence, and then click the
Make Room
button - Click
Save Sequence
to put the sequence over old file select slot Save ROM
as (don't save over your decompressed ROM otherwise you'll need to make another)
Starting at the Files tab (see image below), select the Audioseq index(1) to load all songs and go to the very end and select the credits music(2) and pointerize it(3). Now all of the space used by credits can be used anywhere as songs in the middle can be shuffled down into that dead space. Select the song you want to make big enough for a song slot(4) and use "Make Room" in the bottom left(5) after typing in how much space you want the new slot to take. 0x2800 is the biggest BGM can be for almost all BGM in the game, unless you want to make credits music. Some songs have smaller space requirements, like the owl's theme, and the dancing mask music, but in general I prefer to use the one largest slot for everything and just keep the song size in mind.
In vanilla MM, the Fileselect song slot is just a pointer to fairy fountain, and is not marked in Seq64 as file select with the old romdesc, and is slot 0x18. Titlescreen is 0x76. Clocktown day 1 is 0x15. Termina Field is 0x02, Combat music is 0x1A, those are the most useful testing slots in my opinion, but you can test in any slot.
Injecting a song into your test rom
Save the sequence to the slot by selecting the entry on the left and hitting the purple "save sequence" button in the bottom left, and then you need to change the bank pointer for that sequence, so that it plays the right instruments. This is done by selecting the bank in the bottom right of the window.
Saving the sequence only saves the sequence to the audioseq file in ram, it has not be saved to the rom yet, you need to now save the whole rom under ROM(top menu)->Save
If you did everything right, you should be able to load your audio testing ROM in any emulator of your choice and it should play the music where you put it (don't touch anything and titlescreen will play, hit A twice for file select)
Step 3a: Creating a custom instrument set
If you can't find a vanilla instrument set in MM that has all of the instruments your song needs, you need to make a custom instrument set.
Here is a guide on making custom instrument sets: https://github.com/isghj5/mm-rando/wiki/Custom-Instrument-Set-Creation
Step 3b: loading a custom envelope into the sequence directly
The sequence binary allows for envelope data to exist in the sequence instead of the instrument set, this is more work but allows you to have custom instrument like control but without the bank.
This has a few advantages:
- OOTMMR does not support custom instruments sets now, so your songs have to use vanilla instrument sets. If all you wanted was envelope adjustment from your custom banks, this can do the trick.
- You can make more complicated and intricate envelopes than what the banks allow for, as the banks are limited to 3 point envelopes, and sequence envelopes are not (limits are unknown)
The envelope is a series of point data between NOTE-ON until NOTE-OFF takes over and starts the release section, where every point has two values: the x value in time (in ticks) since the last value (or NOTE-ON), and y value in volume (out of 37200). The two values are u16, such that the two make one one word (4 bytes) of data. The last word of the envelope needs to be metadata, describing how the envelope behaves.
The general envelope used by the game when an instrument doesn't have one.
// default envelope for instruments that dont have one, like sound effects
EnvelopePoint gDefaultEnvelope[] = {
{ 1, 32000 }, // (1: 0x0001), (32000: 0x7D00)
{ 1000, 32000 }, // (1000: 0x03EB), (32000: 0x7D00)
{ ADSR_HANG, 0 }, // (ADSR_HANG: 0xFFFF), (0: 0x0000)
{ ADSR_DISABLE, 0 }, // (ADSR_DISABLE: 0x0000), (0: 0x0000)
};
// writing total as binary, back to back becomes 0x00017D00 0x03EB7D00 0xFFFF0000 0x00000000
// regular envelope used by common instruments in banks
EnvelopePoint commonEnvelope[] = {
{ 2, 32700 }, // (2: 0x0002), (32700: 0x7DBC)
{ 1, 32700 }, // (1: 0x0001), (32700: 0x7DBC)
{ 32700, 29430 }, // (32700: 0x7DBC), (29430: 0x72F6)
{ ADSR_HANG, 0 }, // (ADSR_HANG: 0xFFFF), (0: 0x0000)
};
// writing total as binary, back to back becomes 0x00027DBC 0x00017D8C 0x7DBC72F6 0xFFFF0000
Where the first envelope quickly rises to full volume (almost no attack) and sits at full volume (1000 ticks later, remain at same volume), then hangs there.
If you wanted to increase "attack" (although its not true asdr) you would generally increase the first value (1) to a longer value which turns the start of the envelope into a slope between 0,0 and 1,32000. If you wanted some decay, change the second value, the third value traditionally is sustain, but if you made your own envelope you could have it go up and down as you want, just keep in mind you have little control here: the only two events that tie into this envelope is NOTE ON and OFF, there is no way to modulate it with parameters.
In the second envelope, there is another worthless decay phase (likely has to be there in regular envelopes or was auto-generated by their software) and then there is a slight sustain slope down to 29430 over a long time.
With regards to behavior of the envelope, you need the last word (time/amplitude) combo to instead be metadata that tells the game what kind of envelope type it is
#define ADSR_DISABLE 0
#define ADSR_HANG -1
#define ADSR_GOTO -2
#define ADSR_RESTART -3
So if you wanted to make a looping envelope with a short loop or cycle completely over the whole loop you could do that instead of just holding the last value.
Seq64 1.X does not support envelope section at all, and Seq64 2.0 supports modifying as a mus file but not adding.
You will need to use a hex editor to modify your sequence to add an envelope to your sequence, at least at first, you want to do this LAST after all sequence modifications are done. Start by your sequence in Seq64, add the (channel command: set envelope) instruction in at least one channel, and save the raw sequence, then add extra space for the new envelope binary data at the end. Now you can re-import the raw sequence and change the [set envelope] command value to point at the location of the new envelope space (at the end of the sequence, your hex editor should have told you what this value is on the left side)
** WARNING: ** the envelope has to be aligned or the game will crash, not sure yet if it needs to be 0x4 or 0x8 or 0x10 aligned, but you need to make sure the start of your envelope is clean, so you might want to just give yourself extra zeros in case you need to add/remove commands from your sequence after adding the envelope, which will move it. At that point, add or remove zero padding between the envelope and the end of your sequence and then fix the custom envelope command.
** NOTE: ** the set envelope command must come after an instrument command in the channel, or the set instrument command will overwrite the envelope to the one from the instrument set.
Troubleshooting songs:
If all the instruments are different than what you expect (harp instead of guitar, drums instead of flute), you forgot to set the correct instrument set for your song, go back to seq64 files tab and set the bank (bottom right) and save the rom again. If one instrument is wrong, that instrument is set wrong and you must return to the Audioseq tab->Chn section->Instrument and change that instrument to the right value, save sequence again, then rom.
If the seq in audioseq is empty except for a single seqheader after importing a midi, and your seq64 console is full of note errors (No Track Note command defined), you forgot to load your seq64 romdesc for Majora's Mask. Load the romdesc into seq64, then try to import your MIDI again.
If the instruments sound only a little off, like extra reverb, there was a flaw in your soundfont when you designed the midi. If your sequence uses vanilla banks, not much you can do from this side, tweak your soundfont so that it matches more closely. If you're using a non-vanilla instrument set, open the bank in the Audiobank tab of seq64 and modify settings in the envelopes folder.
If only a few instruments are miscalibrated, make sure your midi only uses 15 or fewer channels, MM cannot handle more than that. If only one is wrong, maybe you misclicked, check that the wrong instrument(s) values are correct in the relevant channel headers.
If some instruments are too loud, you need to go back to the Audioseq tab and lower the volume per instrument channel by Selecting the relevant Chn section, and looking for the Chan Volume value and increasing or decreasing the value. Don't forget the loop copy of that instrument.
If all instruments are too loud, and you want to decrease all volumes at the same rate, you can lower master volume in the Seq header under Audioseq->Seq header->Master Volume.
If the instruments change after the first or second loop, you forgot to set the instruments for the second chn set in seq64. The loop will often create a second channel header for when the loop starts, sometimes it has instrument commands so it changes your instruments. Go back and make sure each instrument is the same in both sets of instruments. You could also delete the instrument command in those later channels, its technically optional, seq64 just decided to include it automatically.
If the instruments die off slowly as the song continues, make sure your loop is not in the middle of a note. If your loop cuts through the middle of a note it can cause some weird instrument behavior once it gets imported into seq64.
If some notes from certain channels are missing, and those channels are using more than 4 notes at the same time, that's because there is a 4 note max limit per channel, if you still have channels available you can move some notes to a new channel to work around this.
If notes sometimes start playing way too early, like the loop is triggered early, it might be because there is a very small 1/96 size note that seq64 doesn't know how to handle, search for those, sometimes seq64 will complain that there are too many notes on a channel, because it adds one that you couldn't see.
If some notes are way out of order and most notes are missing, the whole song is wrong, check the seq64 console. If you see something like "Note end reached before note started" then you have stacked notes (a note on top of another note in the spot, or a smaller note completely inside of another note), which seq64 cannot handle, you need to find those notes hidden inside of other notes and remove them. Seq64 console should give you a time stamp for those notes, take that time stamp and divide by 192 (ticks per BAR) and then add one (MIDI bar count starts at 1, not zero) so if your timestamp is 6192, divided by 192 is 32.25, add a bar, and your hidden note should be at midi 33:2 (bars start at 1, bar quarters start at 1 too, so :2 is the 1/4th of a bar, :4 is the 3/4 way not the end of the bar that's 34:0)
Step 4/5: Saving and file packing
Once everything sounds good, you can save your file as ZSEQ in the Audioseq tab, under "Save Raw". My latest audiobank ripper will also yank the zseq file from a rom if you were working on a bank.
To play in the randomizer there are three options:
- (recommended) Combine your ZSEQ and extras into a MMRS File.
- If your sequence uses a vanilla bank, you can also just rename your raw zseq file with the filename format FILENAME_INSTSET_CATEGORIES.zseq and the rando will find them, but this is a bit uglier than the MMRS solution (also the project founder specifically requested we find an alternative, but haven't yet forced us to move, so this might not be an option one day)
- (recommend avoid) move your ZSEQ file to the Resources/music folder with or without a file extension, then add the file to the Utils/SEQS.txt file using SEQS.txt fileformat (See the advanced MMR music guide in the side bar to learn how to edit this file) (This will only work for you though, you won't be able to share it with others without them also adding the entry to their SEQS.txt file.)
MMRS File Format (very easy to make, and prefered)
Make a new zip archive containing a file called "categories.txt" that contains your categories separated by '-' or ','. Rename your zseq file to the instrument set it uses (if it uses instrument set 0x03 rename it to 03.zseq), and add to the archive.
Categories describe which places your music can show up here is the list we have (Feb/2020):
0 = Field
1 = Towns
2 = Dungeon
3 = Indoors
4 = Minigame
5 = Action Cutscenes/Events (aliens, sharp, etc.)
6 = Calm Cutscenes/Events, Character Themes (Keaton, File Select, Song of Healing CS, etc.)
7 = Boss Fight
8 = Item Get, Minigame Win, Soaring CS
9 = Game Over
10 = Area Clear
16 = Special (Just Ending CS and Title Screen)
thanks to darkychao for gathering this for us, since DB didn't write it down
Also, as of MMR 1.13, each song has it's own unique category, which is the sequence number as hex added to 0x100. Combat music, for instance, is song number 0x1A in the vanilla game, the category is 0x1A + 0x100 = 11A. You can look these up in the SEQS.txt file found on the MMR github, or on deathbasket's sequence resource page linked at the top of this guide, but this is mostly if you want to be super specific with your m
Example of making a MMRS file: you made music that you want to play in the field or a dungeon, and it uses bank 18
Create a zip archive and place your categories.txt file and zseq inside of it:
MY-MUSIC.mmrs
- categories.txt = 0,2 (in this example)
- 18.zseq
If you need custom instrument set, just name the bank and metadata same as the sequence
MY-MUSIC.mmrs
- categories.txt = 0,2 (in this example)
- 18.zseq
- 18.zbank
- 18.bankmeta
If you need a custom instrument set, and you want to decrease chances the bank you need is already taken, you can add redundant seq/bank combos together into one file, increasing likelihood of finding a free instrument set slot.
MY-MUSIC.mmrs
- categories.txt = 0,2 (in this example)
- 18.zseq
- 18.zbank
- 18.bankmeta
- a.zseq (optional) (redundancy #1)
- a.zbank (optional)
- a.bankmeta (optional)
- 2.zseq (optional) (redundancy #2)
- 2.zbank (optional)
- 2.bankmeta (optional)
- ...
then rename your MY-MUSIC.zip it to MY-MUSIC.mmrs for the randomizer to use it, where the filename can be anything.
(you can tell windows that 7z can open MMRS files and 7z can auto detect its a zip even after being renamed)
WARNING: our zip reader is not capable of reading a 7zip or rar file, it MUST be a Zip archive, not just any compressed archive.
WARNING: our zip reader only checks out the base directory inside of an archive, if the files are inside of a folder inside of the zip, then it will NOT be detected, and nothing will happen.
WARNING: our zip reader is picky about filenames, and is case sensitive. the categories file must start with a lower case 'c', and if you have custom instrument sets included, the sequence, bank, and bankmeta must all have the same spelling for the number, for them to be considered paired.
Creating a listening sample
When other people want to add music to their game, they often want to hear what your music will sound like before they consider adding it to their game.
You have two options: You can inject the song into a rom and play the song in-game and record the audio output (which is more accurate to how it will sound in an MMR seed) or you can render a close approximation from your MIDI editor. For recording you have several options: PJ64 has an audio plugin that supports recording directly to file with limitations. You can download the free program Audacity which can record system volume, or you could download the free video recording program OBS (Open Broadcast Software) which is commonly used by streamers to record their games and screen to streaming websites, but also supports recording to video instead (and captures system auio).
If you do decide to render in your editor, and you have FLS, DezZival suggests you set resampling to 2-point or 6-point, which more accurately represents how it wont be re-sampled on n64 hardware.
Songtest
For testing a song and recording a sample, you can add a token to a songs name to force that song every seed to be placed into the seed.
This token is "songtest", if you made a MMRS file it can go anywhere in the filename, at the start: songtest-music.mmrs
the end music_songtest.mmrs
or anywhere why-songtest-tho.mmrs
. If you made a zseq, it has to go in the filename section, before the first underscore (_) character in the filename, eg songtest-music_3_0-2-3.zseq
.
With songtest in a song's filename, any seed that song will be placed in:
- Title screen: reachable without any controller input
- File select: a clean spot where the song plays forever
- Clocktown Day 1: Good for comparing to average gameplay volume, and you can trigger fanfares to see if fanfares kill your song
- Combat music: good when you aren't sure if its loud enough, and/or if it kills BGM
- Any other song slot that shares a category with your song: so you can check volume in minigames, dungeons, bossfights, zorahall, ect.
Just don't forget to remove songtest from the filename when you are done testing/recording.
Questions?
If you have questions or need help visit #music channel in the MMR discord: https://discord.gg/8qbreUM