Wii Music: Custom Song Tutorial

Hi, I promised that I would make this tutorial after the release of RiiMajor. It took a while for me to finally make it because I was working on a lot of other things.
So let's just get right into it. I asked about this a while ago and I got a couple replies, one basically telling me to fuck off and that nobody cares. Well, It turned out to be the opposite seeing how many people downloaded RiiMajor.

BEFORE YOU START
You're going to have to hex edit. Yeah, I know. The reason for that is... Wii Music uses an older version of BRSAR which BrawlCrate does not support. We've asked so many times and submitted a ton of bug reports but since it's not a Brawl related issue, the devs don't want to try and look into fixing the error you get while trying to save the edited BRSAR. So you'll have a lot of limitations. Which are:
  • The song can't be bigger than the original in hex
  • The tempo has to be the same as the original song
  • 1/128 notes don't work Correctly
You'll have to do a lot of editing to make sure it fits within the original entry size. If it weren't for this, RiiMajor might have been done 2 months early.

STEP 1: FIND THE OFFSETS AND SONG LENGTHS

I already did it for you http://jimmysstuff.tk/WiiMusicDataTable.html
  • Offset = The hex offset into the file
  • Length = The length of the file in hex.

STEP 2: PREPARE A MIDI FILE THAT YOU WANT TO USE
I already planned to import one, so that's the midi I'll be using as an example.
"Beverly_Hills_Cop__Axel_F__mar2track_fmin_version1.mid"

The midi must have 4 tracks. They must be in this order:

Track 1 = MELODY
Track 2 = HARMONY
Track 3 = CHORD
Track 4 = BASS

Track 1 must have the tempo data in it or else it wont work properly



- One bar of your midi will equal one entire line of score in Wii Music, so you may need to ensure it is fast enough.
- There needs to be at least one track that has a note that plays at the end of the last bar, otherwise the track lengths will be weird.
- Wii Music does not properly support 1/128 notes.
- Notes are not allowed to overlap in time, unless they all start at the same time as a chord.

Look at the datatable for the length in time of the song you want to put the song over, delete any notes that go over that length in the midi.

STEP 3: CONVERT MIDI TO BRSEQ

  1. Download GotaSequenceCmd
  2. Unzip it
  3. (Highly Recommended) name the midi file "Z.mid"
  4. Drag the midi into "from_midi.bat
STEP 3.5: (OPTIONAL) CHANGE TEMPO AND KEEP NOTES THE SAME
The wonderful kitlith has made a program that allows you to change the tempo in a brseq file and keep the notes the same.
So lets say that the midi you converted to BRSEQ was 70BPM, but the song you want to put it over is 100 BPM. Well this program allows you to make the BPM 100. But the notes
will sound exactly how they were at 70BPM.

You can download it here!

Usage:

Code:
tempo.EXE Z.brseq -t 160

Z.brseq = The recommended name for the BRSEQ you want to change the tempo of. Of course, you can name it whatever you want.
160 = The tempo that the BRSEQ will be changed to. Change it to whatever you want.

OTHER: (OPTIONAL) LOOPING
In all 4 tracks in the midi you plan to use, find the place where you want the song to start looping, and end looping.
  1. Create a note with the velocity set to 0 and the note set to 0 where you want the loop to start in all 4 tracks
  2. Create a note with the velocity set to 0 and the note set to 127 where you want the loop to end in all 4 tracks
  3. Convert the midi to BRSEQ with "from_midi.bat"
  4. Drag the outputted BRSEQ into "dissassemble.bat"
  5. Open it in a text editor
  6. Search for
  7. Replace it with
    Track_X_LOOPSTART:
    The "X" is the track number. Do this for every track
  8. Search for
  9. Replace it with
    jump TRACK_X_LOOPSTART:
    The "X" is the track number. Do this for every track.
  10. Drag it into "assemble.bat"
  11. Go to Step 4.


STEP 4: ADD THE SONG IN THE BRSAR
  1. Open the datatable in a new tab.
  2. Search for the name of the song you want to replace with your custom song.
  3. Copy the offsets for both "SONG" and "SCORE"
  4. Once you have found it, open the Wii Music BRSAR ("/Sound/MusicStatic/rp_Music_sound.brsar") in HXD.
  5. Continue down below.
For example: Let's say that I wanted to replace the song "September". This is what I would have to do. The same process is used for every song, except the offsets are different for each one.

First, Find this: (Find the info for whatever song you plan to replace)
unknown.png

SONG = The notes the tutes play
SCORE = The notes you play.
You just have to replace them both with your custom BRSEQ.

REPLACING "SONG"
1. Open the BRSAR in HXD
2. Press CTRL+E
3. Type in the "SONG" offset where it says "Start Offset" (Offsets will vary depending on what song you are replacing)
4. Type in "LENGTH" (In hex, not the song length) where it says "Length" (Length will vary depending on the song you replace)
5. Press OK
6. Right Click on the highlighted area
7. Select "Fill Selection"
8. Enter in "00"
9. Press "OK"
10. Repeat Steps 2 - 5


11. Open the BRSEQ you got from either Step 3 or Step 3.5
12. Press CTRL+A
13. Press CTRL+C
14. Go back into the BRSAR you have open
15. Press CTRL+V


REPLACING "SCORE"
1. Open the BRSAR in HXD
2. Press CTRL+E
3. Type in the "SCORE" offset where it says "Start Offset" (Offsets will vary depending on what song you are replacing)
4. Type in "LENGTH" (In hex, not the song length) where it says "Length" (Length will vary depending on the song you replace)
5. Press OK
6. Right Click on the highlighted area
7. Select "Fill Selection"
8. Enter in "00"
9. Press "OK"
10. Repeat Steps 2 - 5


11. Open the BRSEQ you got from either Step 3 or Step 3.5
12. Press CTRL+A
13. Press CTRL+C
14. Go back into the BRSAR you have open
15. Press CTRL+V


Now you are ready to test it in the game!
-------------------------------------------------------
I'll admit, the tutorial was a bit thrown together, I also had some problems with formatting that I couldn't figure out how to fix. But this method was how I imported all of my songs for RiiMajor. Let me know if you have any issues!

Credits:

AdamCrossing and Paniaal - Extensive Testing of how BRSEQ worked in game.
kitlith - Tempo.exe and other BRSEQ handling programs.
Gota7 - GotaSequenceLib and GotaSequenceCmd.
 

Kitlith

Well-Known Member
Newcomer
Joined
Jan 29, 2016
Messages
93
Trophies
0
Location
Trapped between a rock and a hard place
Website
kitl.pw
XP
218
Country
United States
Minor nitpicks:
  • Wii Music actually uses a newer version than brawl, which is actually the highest known version, and I think the actual issue is somewhere within BRFNT or some of the other "inner" formats.
  • Why name the file Z.midi ? At most, I wouldn't put any spaces in the filename. nvm, it's a single letter filename to decrease the size of the label section. any single character filename will do.

There's also an alternative method for looping + some more details on looping which I'll cover here:
Requires:
  • A Midi Editor that can insert markers or cue points on any track
    • MidiEditor (https://www.midieditor.org/) works.
    • FL Studio apparently does not export markers to midi, and thus will not work. (though cue points haven't been tested last i checked)
  • GotaSequenceCmd (specifically, the from_midi functionality)
Steps:
  1. Identify what your aim is, and where your loop points are located.
    • In general, you'll want to find the start and end of one loop repetition, and if you're aiming at compressing the BRSEQ then you'll want to find the end of where you're looping to.
    • There are 3 main types of loops that I've run across so far, and the differences between them:
      • Infinite loops (for i.e. menu music): You need to place a
        Code:
        jump <label>
        instruction at the end of the loop. You can feel free to delete instructions after the end of the loop up until the end of the track (the
        Code:
        end_track
        instruction) afterwards to possibly save a bit of space. There should be one of these on each track if you're adding it.

      • Conditional Infinite Loops (so that a song plays infinitely during song selection, but not in-game): You need to place a
        Code:
        cmp_eq 14 10000
        somewhere before the end of the loop, and a
        Code:
        jump_if <label>
        at the end of the loop. Don't delete instructions after the loop, as you'll need them in-game. There should be one of these on each track if you're adding it.

      • Finite Loops (e.g. for compression): Count the number of times your loop should execute. You need to place a
        Code:
        loop_start <count>
        instruction at the beginning of the loop, and a
        Code:
        loop_end
        instruction at the end of the loop. You'll also want to add a label at the end of where the loop repetitions stop, so that you can remove all of the now redundant instructions between the end of the loop and the point where the loop repetitions stop.
  2. In your midi editor, add markers or cue points at all of the spots relevant to the loops you want to create, as detailed above. You can add either a BRSEQ label or a BRSEQ instruction in each marker/cue point. You need to make sure that the marker or cue point is on the track you are currently trying to loop (i.e. if all labels end up on track 0 or something, this won't work).
    • Labels are easy, though some tools will probably break if you include spaces in them. Just put the label text straight into the marker/cue point.
    • Instructions are formatted as follows:
      Code:
      <track number>: <instruction>
      , for example:
      Code:
      4: jump_if Track_4_Cond_Loop_Start
      The space is important.
      • In a future version of GotaSequenceLib/GotaSequenceCmd the track number may not be necessary, but at the moment it is necessary for weird reasons.
    • You can either just add labels everywhere (serving the same purpose as the marker notes @JimmyKaz mentioned) and go in the disassembly afterwards to replace the labels with the relevant instructions, or you can add the instructions directly in the midi. Your choice on what to do.
  3. Once you've marked all of your loop points, save and run the resulting midi file through GotaSequenceCmd's from_midi.
  4. Disassemble the resulting brseq using your favorite disassembler (i'm aware of GotaSequenceCmd and rseq_rs) and perform any necessary cleanup, such as removing instructions from after infinite loops and finite loops, and check that your loops appear to be correct.
  5. Re-assemble the BRSEQ. You should now be done!
There are some more advanced things you can do with BRSEQ that you may be interested in if you're trying to obtain the smallest filesize you can get, such as creating "functions" (label at beginning,
Code:
ret
at end,
Code:
call <label>
at callsites (useful for sharing stuff between tracks, or between identical sections that don't quite loop), doing math and using variables, etc. that I'm not going to go into full detail on, but I'll link the instruction reference that Atlas made a while back: https://pastebin.com/xgsKecv9

I think that covers everything (at a high level, at least)? Other than "how to use your midi editor to insert markers. Maybe I'll add that later. *shrug*
 
Last edited by Kitlith,

MastorLichi

Member
Newcomer
Joined
Mar 2, 2021
Messages
9
Trophies
0
Age
21
XP
71
Country
United States
hello! I'm having some trouble with the dragging portion. I've named my midi file correctly, no spaces, and everything, and I always get this error message. Any help would be appreciated!
 

Attachments

  • 706EB9D7-652F-4470-916D-70A511E2EC51.jpeg
    706EB9D7-652F-4470-916D-70A511E2EC51.jpeg
    1.4 MB · Views: 274

ego-lay_atman-bay

Member
Newcomer
Joined
Aug 7, 2021
Messages
7
Trophies
0
Age
17
XP
55
Country
United States
I'm having an issue with dragging and dropping the .mid file onto the batch file. Whenever I drag and drop Z.mid onto from_midi.bat, it seems like nothing happens. No new files, no command prompt showing up, and no error messages. It just does nothing. Can someone please tell me how to get it to work? I don't care if I have to use the command line.
 

ego-lay_atman-bay

Member
Newcomer
Joined
Aug 7, 2021
Messages
7
Trophies
0
Age
17
XP
55
Country
United States
I am having trouble with dragging and dropping Z.mid onto the batch file. I do it exactly as the tutorial says, but nothing seems to happen. No command prompts, no new files, and no error messages. Can someone please tell me how to fix this? I don't care if I have to use the command line.

edit: I just got it to work.

For anyone else having this issue, here's how I got it to work.
  1. Inside the GotaSequenceCmd folder, go into the bin/debug folders.
  2. Open the command prompt, click on the top bar where it shows what folder you're in.
  3. Type cmd, then hit enter.
  4. Drag and drop "GotaSequenceCmd.exe" into the command prompt.
  5. Type "from_midi"
  6. Then drag and drop Z.mid into the command prompt.
  7. Finally, hit enter. You should get Z.brseq in the same folder as Z.mid.
 
Last edited by ego-lay_atman-bay,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: @OctoAori20, Thank you. Hope you're in good spirits today like I am. :)