Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.

Reply
 
Thread Tools
  #1    
Old September 5th, 2010 (10:22 AM). Edited September 12th, 2010 by Sonic65.
Sonic65's Avatar
Sonic65 Sonic65 is offline
welp
     
    Join Date: Aug 2010
    Location: Columbia, Maryland
    Age: 23
    Gender: Male
    Nature: Quirky
    Posts: 27
    Figured I should probably register and post this here too, since this thread here was a big help to me...even if this entire post is basically just a copypaste from the Pokecommunity one (well, will be as soon as it gets approved anyway)

    Anyway, I've been researching R/B/Y ROM hacking for a short while now, and I found that there was little real documentation or tools on the music side of the game (well actually in general, compared to 2nd/3rd gen). So I made this program to import music into an R/B/Y ROM - more specifically, import .ftm songs made with the program Famitracker, a music tracker for the NES.


    What does it support?
    • Importing of all 4 basic sound channels (square 1/2, triangle, noise)
    • Both .ASM and .BIN export
    • Quick ROM inject feature for .BINs
    • Famitracker note fade-outs (using the volume column) and duty cycle changes (by changing instruments)


    What doesn't it support?
    • MIDI import or any other file format other than .ftm
    • Any Famitracker effects



    Files in zip:
    • rbyImport.exe - The actual RBY Music Importer program.
    • blitz3d_gui_dll.dll - A DLL the program uses.
    • readme.txt - Derp. Doesn't have anything this post doesn't anyway.
    • route202.ftm - Sample FTM file to import (used in tutorial below). A NES/GB demake of the Route 202 theme for Pokemon Diamond/Pearl.
    • noiseChannelDoc.txt - Documentation on the music format Pokemon R/B/Y uses for noise channels (this didn't seem to be documented anywhere, so I investigated it myself - it's different from the regular music channels, and uses drum presets)
    • pkms.asm - Macros and equates for ASM files created with RBY Music Importer. (PKMS is what I call the Pokemon RBY music format, standing for Pokemon Music System)
    • rgbasm.exe - GB compiler, part of RGBDS suite
    • xlink.exe - GB linker, part of RGBDS suite


    How to Use: A Tutorial

    To illustrate how to use RBY Music Importer, we're going to import the sample song (route202.ftm) and replace Pallet Town's music with it. Here's a step-by-step guide (I suck at writing tutorials but hopefully you'll understand this):

    • Open up RBY Music Importer and go to the FTM->ASM section. Load route202.ftm using the Load FTM button.
    • Using the DataCrystal ROM map of Pokemon Red, you'll find that Pallet Town's music data starts at $A7C5, so put in $A7C5 as the start offset.
    • Check the "Import noise channel" box. You don't need to change the tempo for this particular song, but you might need to for other songs (more on that later).
    • Click the "Make ASM File" button. RBY Music Importer will generate an .asm file called route202.asm. At this point you have one of two options: either you can go and tweak the ASM file (changing notes, adding effects like vibrato and modulation, etc.), or just proceed straight to .BIN conversion. Let's go straight to .BIN conversion and injecting, for the purposes of this tutorial.
    • Go to the ASM->BIN section and load the route202.asm file we just created.
    • Click the "Inject music into ROM" checkbox.
    • Set $A7C5 (the same offset as above) as the injection offset. (If you changed the start offset in the ASM file, you'd put that value here instead.) Using the same ROM map as above, you'll find that Pallet Town's song pointers start at $822E, so input that for the pointer offset.
    • Click the "Compile BIN File" button.
    • Done! If you did everything right, when you load your RBY ROM, Pallet Town's music should be replaced with Route 202!


    Special Notes

    There doesn't appear to be any hard-set formula for converting Famitracker song tempo into PKMS song tempo, but here are a few tempo matchups which might be useful to you:

    Code:
    $E0 - speed 6, tempo 85
    $D0 - speed 6, tempo 90
    $C0 - speed 6, tempo 100
    $B0 - speed 6, tempo 110
    $A0 - speed 6, tempo 120
    $90 - speed 6, tempo 140
    $80 - speed 6, tempo 160
    $70 - speed 6, tempo 180
    $60 - speed 6, tempo 200
    $50 - speed 6, tempo 220
    $40 - speed 6, tempo 260
    $30 - speed 6, tempo 340
    Finally, I'd like to thank:
    • Coolboyman and Melash, for creating the document I linked
    • Data Crystal, for their Pokemon ROM map


    So yeah, that's all. Hopefully this utility will be useful to somebody other than me.
    Reply With Quote

    Relevant Advertising!

      #2    
    Old September 6th, 2010 (8:54 AM).
    ~Teh Panda~'s Avatar
    ~Teh Panda~ ~Teh Panda~ is offline
    Sea of Dreams - Redux
    • Silver Tier
     
    Join Date: Aug 2007
    Posts: 906
    Well this looks certainly interesting, but do you think you could post how this would be more beneficial then using Sappy, or if it's different as a whole. Because I haven't tried it and don't see reason to until I know exactly what it can do better than what we have.

    Thanks

    EDIT: Wow, this is for Red, Blue, Yellow. I am stupid... XD...

    Well this should be nice for GB/GBC era hackers...
    __________________




    Mystic still in work to let you know...
    Reply With Quote
      #3    
    Old September 6th, 2010 (8:59 AM). Edited September 6th, 2010 by Incineroar.
    Incineroar's Avatar
    Incineroar Incineroar is offline
    the spirit of the fighter
    • Moderator
    • Platinum Tier
    • Developer
     
    Join Date: May 2009
    Location: Iki Town
    Age: 22
    Gender: Male
    Nature: Brave
    Posts: 13,480
    OMG. ILY. :3 This is something I so want! This is a must try for me! I also love Famitracker! Now, to find FTM Files on the internet! WOOOOSH!
    EDIT: Can you get this to work with .nsf files as well?
    __________________
    Reply With Quote
      #4    
    Old September 6th, 2010 (9:42 AM).
    Sonic65's Avatar
    Sonic65 Sonic65 is offline
    welp
       
      Join Date: Aug 2010
      Location: Columbia, Maryland
      Age: 23
      Gender: Male
      Nature: Quirky
      Posts: 27
      Quote:
      Originally Posted by Team Fail View Post
      EDIT: Can you get this to work with .nsf files as well?
      An NSF file is literally just a modified NES ROM, with only music code and data - since the format of music data and how it's played differs from game to game, there's no standard format and it can't really be done (although VirtuaNSF has a keyboard player thing for NSFs, I might look and see how that's done). You'll have to do with manually recreating songs in Famitracker (or composing new original ones).

      I might be able to put in MIDI support later down the line, but that's just a pipe dream for now.
      Reply With Quote
        #5    
      Old September 6th, 2010 (9:55 AM). Edited September 6th, 2010 by Incineroar.
      Incineroar's Avatar
      Incineroar Incineroar is offline
      the spirit of the fighter
      • Moderator
      • Platinum Tier
      • Developer
       
      Join Date: May 2009
      Location: Iki Town
      Age: 22
      Gender: Male
      Nature: Brave
      Posts: 13,480
      Quote:
      Originally Posted by Sonic65 View Post
      An NSF file is literally just a modified NES ROM, with only music code and data - since the format of music data and how it's played differs from game to game, there's no standard format and it can't really be done (although VirtuaNSF has a keyboard player thing for NSFs, I might look and see how that's done). You'll have to do with manually recreating songs in Famitracker (or composing new original ones).

      I might be able to put in MIDI support later down the line, but that's just a pipe dream for now.
      Ok, I'm good with that. I'll have to look further then. Hmmm...
      Edit: FT has a MIDI importer, but it is poor quality. Unless the tempo can go beyond 255 (FF) bytes, then songs I want cannot be done.
      __________________
      Reply With Quote
        #6    
      Old September 9th, 2010 (2:37 PM).
      Chaos Rush's Avatar
      Chaos Rush Chaos Rush is offline
         
        Join Date: May 2007
        Gender: Male
        Posts: 1,302
        Would this work for Pokémon Gold? Also, how would I port R/B/Y music over to Gold?
        __________________
        Reply With Quote
          #7    
        Old September 12th, 2010 (9:49 AM).
        Sonic65's Avatar
        Sonic65 Sonic65 is offline
        welp
           
          Join Date: Aug 2010
          Location: Columbia, Maryland
          Age: 23
          Gender: Male
          Nature: Quirky
          Posts: 27
          Updated OP with new bugfixed version, which should hopefully fix some of the bugs people are having. (Thanks to Team Fail for his help with this, even though we could never get it completely working on his computer )

          Quote:
          Would this work for Pokémon Gold? Also, how would I port R/B/Y music over to Gold?
          If you changed the equates/macros in the pkms.asm file it could probably work, at least with the first three channels (noise channel values are hardcoded as of now, so you'd need to change those manually in the .asm file that RBY Music Importer outputs before compiling the .bin). This document is a pretty good resource for the G/S/C and R/B/Y music format (though I had to find the RBY coordination flags myself, but those are already documented in pkms.asm).

          As for porting music from R/B/Y, that's not something this tool allows you to do (unless you resequence the entire thing in Famitracker, LOL) - you'd have to do that manually in a hex editor (changing pointers and all).
          Reply With Quote
            #8    
          Old September 22nd, 2010 (5:53 AM).
          Heart's Soul's Avatar
          Heart's Soul Heart's Soul is offline
          Hey, look, I was gone.
             
            Join Date: Nov 2007
            Age: 21
            Gender: Male
            Posts: 2,536
            Interesting, considering most of the Red ROM map was made by Coolboyman.
            __________________
            I've been on this forum for about 10 years now. You guys wanna see a rare badge? I got some rare badges.
            Reply With Quote
              #9    
            Old January 1st, 2011 (10:35 AM).
            Chaos Rush's Avatar
            Chaos Rush Chaos Rush is offline
               
              Join Date: May 2007
              Gender: Male
              Posts: 1,302
              I'm having trouble getting this to work with G/S/C. This is what I've changed the pkms file to:

              Code:
                  ; ===========================================================================
                  ; PKMS equates and macros
                  ;
                  ; ===========================================================================
              
                  ; equs
                  MUSIC            EQU 0
                  SFX            EQU 4
                  CH1            EQU 0
                  CH2            EQU 1
                  CH3            EQU 2
                  CH4            EQU 3
              
                  ; notes
                  ntC            EQU $00
                  ntC#          EQU $10
                  ntD            EQU $20
                  ntD#          EQU $30
                  ntE            EQU $40
                  ntF            EQU $50
                  ntF#          EQU $60
                  ntG            EQU $70
                  ntG#          EQU $80
                  ntA            EQU $90
                  ntA#          EQU $A0
                  ntB            EQU $C0
                  ntRst          EQU $B0
              
                  ; special drum EQUs
                  dNote          EQU $C0
                  dRst            EQU $B0
                  dNormSpd     EQU $DC
                  d4d3Spd       EQU $D8
                  d5d3Spd       EQU $D4
                  d2Spd          EQU $D0
              
                  ; octaves
                  oct0            EQU $D7
                  oct1            EQU $D6
                  oct2            EQU $D5
                  oct3            EQU $D4
                  oct4            EQU $D3
                  oct5            EQU $D2
                  oct6            EQU $D1
                  oct7            EQU $D0
              
                             
                  ; header stuff
                  pkmsHeader:    MACRO
                              db    ((\1 - 1) * $40) | (\2 + \3)
                          ENDM
                                 
                  pkmsChannel:    MACRO
                                  dw    \1
                                     
                                  IF \2 != 0
                                      db    \2
                                  ENDC
                              ENDM
              
                  ; coordination flags
              
                  ; set velocity/note fade (\1 is velocity, \2 is note length, both 0-15)
                  ; format:    pkmsSetVel        vel, length
                  pkmsSetVel:        MACRO
                                  db    $DC
                                  db    ((\1 << 4) | \2)
                              ENDM
                  ; stop sound
                  ; format:    pkmsEndSound
                  pkmsEndSound:    MACRO
                                  db     $FF
                              ENDM
                             
                  ; $E8 (unknown)
                  ; format:    pkmsE8
                  pkmsE8:        MACRO
                                  db    $E8
              
                              ENDM
                             
                  ; set modulation (\1 is delay, \2 is depth, \3 is rate)
                  ; format:    pkmsModSet        delay, depth, rate
                  pkmsModSet:        MACRO
                                  db    $E1
                                  db    \1
                                  db    ((\2 << 4) | \3)
                              ENDM
              
                  ; set duty cycle (\1: 0 = 12.5%, 1 = 25%, 2 = 50%, 3 = 75%)
                  ; format:    pkmsSetDuty        duty
                  pkmsSetDuty:    MACRO
                                  db    $DB
                                  db    \1
                              ENDM
                             
                  ; set music tempo (\1 is divider, \2 is modifier)
                  ; format:    pkmsSetTempo    divider, modifier
                  pkmsSetTempo:    MACRO
                                  db    $DA
                                  db    \1
                                  db    \2
                              ENDM
                             
                  ; set volume (\1 is volume)
                  ; format: pkmsSetVolume        volume
                  ; (may actually be panning?)
                  pkmsSetVolume:    MACRO
                                  db    $F0
                                  db    \1
                              ENDM
              
                  ; call offset \1
                  ; format:    pkmsCall    offset
                  pkmsCall:        MACRO
                                  db    $FE
                                  dw    ((\1 % $4000) + ((\1 >= $4000) * $4000))
                              ENDM
                                         
                  ; jump to offset \1
                  ; format:    pkmsJump    offset
                  pkmsJump:        MACRO
                                  db    $FD
                                  db    $00
                                  dw    ((\1 % $4000) + ((\1 >= $4000) * $4000))
                              ENDM
              All I've managed to do so far is to replace New Bark Town music with silence. I looked at the Gold Music Hacking Resource document, and changed the bytes accordingly, but all I get is blank music.
              __________________
              Reply With Quote
                #10    
              Old July 13th, 2011 (9:06 AM).
              WrathOfArceus's Avatar
              WrathOfArceus WrathOfArceus is offline
              Arceus Tamer
                 
                Join Date: Jun 2011
                Gender: Male
                Posts: 15
                I did it write,But when i click compile BIN File to insert it, it says memory access violation,And Pallet town's music is still playing.Help!!!!
                Reply With Quote
                  #11    
                Old July 15th, 2011 (10:38 AM).
                Cheesewig's Avatar
                Cheesewig Cheesewig is offline
                Hi!
                   
                  Join Date: Jul 2011
                  Gender: Male
                  Nature: Relaxed
                  Posts: 54
                  Every time I insert an FTM the game freezes when I go to the location.
                  Reply With Quote
                    #12    
                  Old March 1st, 2013 (9:16 AM). Edited March 1st, 2013 by YORAMRW.
                  YORAMRW YORAMRW is offline
                  8-bit producer & Pokémon GB music hacker
                     
                    Join Date: Oct 2012
                    Location: Netherlands
                    Age: 19
                    Gender: Male
                    Nature: Gentle
                    Posts: 48
                    Too bad, this program has no Apreggio and ''4XX'' support.
                    PS: The ''4XX'' effect is a feature which is used in Game Boy games like Tetris, Name Entry.
                    I hope you will make a new version with support for that.
                    __________________
                    Professional Pokémon music hacker and the composer of epic 8-bit devamps
                    Reply With Quote
                      #13    
                    Old April 12th, 2013 (8:52 AM).
                    YORAMRW YORAMRW is offline
                    8-bit producer & Pokémon GB music hacker
                       
                      Join Date: Oct 2012
                      Location: Netherlands
                      Age: 19
                      Gender: Male
                      Nature: Gentle
                      Posts: 48
                      That "4XX"-effect is called LFO.
                      __________________
                      Professional Pokémon music hacker and the composer of epic 8-bit devamps
                      Reply With Quote
                        #14    
                      Old October 20th, 2013 (12:01 AM).
                      Airikita's Avatar
                      Airikita Airikita is offline
                         
                        Join Date: Oct 2013
                        Gender: Female
                        Posts: 61
                        I can't download your tool, I get a message on that site that prevents me from downloading....
                        __________________

                        The Vocaloids battling with Pokemon? What could go wrong?
                        http://www.youtube.com/watch?v=xI8YOOHlEXQ
                        Po pi po! (Pokemon Gold music import)
                        Check out my channel for more!
                        Reply With Quote
                          #15    
                        Old May 21st, 2015 (4:29 PM).
                        spartanreptile13's Avatar
                        spartanreptile13 spartanreptile13 is offline
                           
                          Join Date: Apr 2015
                          Gender: Male
                          Posts: 2
                          I need help trying to change the RBY Trainer Battle to XY Trainer Battle

                          1. What is the tempo hex for Speed 2, 150 bpm?
                          2. What is the injector hex for Trainer Battle theme?
                          Reply With Quote
                            #16    
                          Old December 7th, 2016 (2:39 PM).
                          rinGallows rinGallows is offline
                             
                            Join Date: Dec 2016
                            Gender: Other
                            Posts: 1
                            when i loaded the game when it went to pallet town it froze is there anyway to fix this?
                            Reply With Quote
                            Reply
                            Quick Reply

                            Sponsored Links
                            Thread Tools

                            Posting Rules
                            You may not post new threads
                            You may not post replies
                            You may not post attachments
                            You may not edit your posts

                            BB code is On
                            Smilies are On
                            [IMG] code is On
                            HTML code is Off

                            Forum Jump


                            All times are GMT -8. The time now is 7:33 AM.