1. JimmyKaz

    OP JimmyKaz Member
    Newcomer

    Joined:
    Jan 4, 2020
    Messages:
    11
    Country:
    United States
    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.
    The midi must have 4 tracks. They must be in this order:


    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
      The "X" is the track number. Do this for every track
    8. Search for
    9. Replace it with
      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)
    [​IMG]

    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:

     
    Eleganto, Gekkodox, WiiEJECT and 6 others like this.
  2. Kitlith

    Kitlith Advanced Member
    Newcomer

    Joined:
    Jan 29, 2016
    Messages:
    93
    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, Nov 12, 2020
    Eleganto and WiiEJECT like this.
  3. HarvHouHacker

    HarvHouHacker Owner of Rock Band Customs (Wii/vWii/Dolphin)
    Member

    Joined:
    Mar 24, 2019
    Messages:
    633
    Country:
    United States
    Interesting! I have Wii Music; I might try this out...
     
    Eleganto likes this.
  4. CPG

    CPG good morning.
    Member

    Joined:
    Aug 9, 2016
    Messages:
    729
    Country:
    Canada
    Thank you! Now I can play Eff by Bo Burnham in a nintendo game!
     
    jeannotte likes this.
  5. Oofios

    Oofios Member
    Newcomer

    Joined:
    Oct 7, 2020
    Messages:
    39
    Country:
    United States
    it sucks that it's restricted a lot. Maybe one day there will be a very simple way..
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - Tutorial, Custom, Music