The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.


Advertise here

Reply
 
Thread Tools
  #1    
Old September 14th, 2009, 06:55 PM
Melash's Avatar
Melash
Back for now.
 
Join Date: May 2008
Location: Idaho
Age: 20
Gender: Male
Nature: Relaxed

Advertise here
MUSIC HACKING RESOURCE DOCUMENT


==============
Introduction
==============

Before we start out, let me make something clear. This is not a step by step tutorial on how to hack the music in GB/GBC games, but more a resource you can use in hacking. It’s a little unorganized, but it should help some people out. Sorry it's a bit long and bleak, I tried to make it a little interesting.

==============
Purpose for writing
==============

This document will list the offsets of all music headers in all games, explain the format of the music headers, and the basic format of the music data

==============
Getting Started
==============

Programs needed:

A Hex Editor (Use Google)
Sound Edit v1.3 (http://crystalfallows.110mb.com/Auto...=soundedit.zip)

Skills needed:

Basic usage of a hex editor
Elementary knowledge of pointers

==============
GSC Music
==============

First off, I’ll explain a little about how the music works in GBC. There are up to four channels for every music track; Two are the lead tremble part, one is the bass, and the last is the drums. For every music track, there is a music header. The music header points to where the actual music data is located, the notes and such. Here is a full list of where the music headers are located in GSC, sorted by offset:

Spoiler:

E9492 - S.S. Aqua
EA267 - Ice Path
EAD42 - Trainer- Basic Tune
EB27C - New Bark Town
EB3FC - Goldenrod City
EB61F - Vermilion City
EBD92 - Unown Ruins
EBDCB - Whirl Islands
EBDD5 - Meet trainer - Freaky Tune
EE35E - Meet Trainer - Japanese Tune 2
EE45F - Special Fanfare?
EE569 - Whirl Islands
EE6C5 - Routes 42-44
EE852 - Indigo Plateau
EE94B - Routes 38-39
EEB75 - Rocket's Hideout
EECE8 - Dragon's Den
EEDCB - Unown Radio Station
EEE3E - Trainer Rocket Tune
EEFB2 - Routes 26-27
EF5B1 - Weird
EF9BC - Dance Theatre
EFB3E - Bug Contest Results
0F0386 - Routes 34-37
0F07FD - Printer Error
F4602 - Killed a Wild Pokemon
F605C - Wild Pokemon (Johto)
F66C3 - Trainer Girl Tune
F6811 - Tin Tower
F6974 - Sprout Tower
F6A99 - Burned Tower
F6BF2 - Meet Mom
F6C72 - Victory Road
F6D79 - Pokemon Lullaby
F6E23 - Pokemon March
F7055 - Intro - Part 1
F7308 - Intro - Part 2
F766D - Rockets Take Radio Tower
F78FD - New Game/Continue
F7B13 - Pokeflute
F7C16 - Bug Contest


Now you know where the headers are located, it’s time to learn the format of the music headers. Here is the format of all music formats:

vv ww ww 01 xx xx 02 yy yy 03 zz zz

vv: Byte at beginning of header, not exactly sure what it means
ww ww: 2-byte pointer to first channel
xx xx: 2-byte pointer to second channel
yy yy: 2-byte pointer to third channel
zz zz: 2-byte pointer to fourth channel

If a music track doesn’t have a fourth channel, it simply won’t have the pointer to it. Okay, so we now know where all the music headers are located, and their format. Now it’s time to learn the format of the actual music data. Here’s the note structure for Gold and Silver, I’m assuming it’s the same for Crystal:

Spoiler:

Notes (x = note delay)
0x - No Note
1x - C
2x - C#
3x - D
4x - D#
5x - E
6x - F
7x - F#
8x - G
9x - G#
Ax - A
Bx - A#
Cx - B (H)
D0 - Octave 7
D1 - Octave 6
D2 - Octave 5
D3 - Octave 4
D4 - Octave 3
D5 - Octave 2
D6 - Octave 1
D7 - Octave 0
D8 xx yz - xx Frames per note delay unit, Velocity y, Note Length z
DA hh ll - Set Tempo (yes, hh ll, not ll hh, the lower the value the faster)
DB xx - Duty Cycle (00-03), might also be instrument selection for Ch3
DC yz - Velocity y, Note Length z (basicalyl same as D8 without the xx)
E1 xx yz - Vibrato - Delay xx, Depth y, Rate z
E3 xx - Noise Setting (instrument?)
E6 xx xx - Tune (not sure what the arguments for this are..)
EF xx - Panning (unsure of the arguments..)
FD 00 ll hh - Jump (this is used to set the loop point for the song, ll = low byte, hh = high byte)
FE ll hh - Subroutine (ll = low byte, hh = high byte, the return address is the location directly after this command)
FF - End / Return from Subroutine


You can use Sound Edit v1.3 to add in basic notes, but you actually have to go in and manually add in the loop points and other small stuff. Very annoying, but it’s the only way to do it.

==============
RBY Music
==============

Since we’ve already learned the basics of music headers, I won’t have to reexplain everything again, I can just give you the offsets. Here are all the locations of music headers in RBY:

Spoiler:

822E-8236 Pallet Town
8237-823F Pokecenter
8240-8248 Gym
8249-8254 Viridian / Pewter / Saffron
8255-825D Cerulean / Fuchsia
825E-8266 Celedon
8267-826F Cinnibar
8270-827B Vermilion
827C-8287 Lavender
8288-8290 S.S. Anne
8291-8299 Meet Prof. Oak
829A-82A2 Meet Rival
82A3-82AE Guy Walks you to Museum
82AF-82B7 Safari Zone
82B8-82C0 Pokemon get healed
82C1-82CC Routes 1 / 2
82CD-82D8 Routes 24 / 25
82D9-82E4 Routes 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 16 / 17 / 18 / 19 / 20 / 21 / 22
82E5-82F0 Routes 11 / 12 / 13 / 14 / 15
82F1-82FD Route 23 / Indigo Plateau
7C249-7C254 Title Screen
7C255-7C25D Credits
7C25E-7C266 Hall of FAme Registration
7C267-7C26F PRof Oak's LAb
7C270-7C275 Jigglypuff's Song
7C276-7C281 Bike Riding
7C282-7C28A Surfing
7C28B-7C293 Casino
7C294-7C29F Introduction Battle
7C2A0-7C2AB Power Plant / Unknown Dungeon
7C2AC-7C2B7 Viridian Forest / Seafoam Islands
7C2B8-7C2C3 Mt. Moon / Rock Tunnel / Victory Road
7C2C4-7C2CF Cinnibar Mansion
7C2D0-7C2D8 Pokemon Tower
7C2D9-7C2E1 Silph Co
7C2E2-7C2EA Meet Bad Trainer
7C2EB-7C2F3 Meet Girl Trainer
7C2F4-7C2FC Meet Angry Trainer


The music headers have the same format as GSC. It seems Game Freak doesn’t like to change the coding in their games that much. Unfortunately the basic note structure is a little different. Here’s the basic note structure for Red and Blue, once again I’m not sure if Yellow is exactly the same:

Spoiler:

Notes (x = note delay)
0x - B
1x - C
2x - C#
3x - D
4x - D#
5x - E
6x - F
7x - F#
8x - G
9x - G#
Ax - A
Bx - A#
Cx - No Note

Note Delay:
x0: 1/16
x1: 1/8
x2: 1/8.
x3: 1/4
x4:
x5: 1/4.
x6:
x7: 1/2
xB: 1/2.
xF: 1

E0 - Octave 7E1 - Octave 6
E2 - Octave 5
E3 - Octave 4
E4 - Octave 3
E5 - Octave 2
E6 - Octave 1
E7 - Octave 0

It’s almost the same as GSC. The octave data has changed along with several other bytes. So, you can’t import songs from RBY to GSC by using a “copy and pasting” method, but you can manually redo it without too much stress. Unfortunately I only have the basic structure, and not the other data, such as loops points and other information.

==============
Credits
==============

All right, that’s all the music data I’ve found. If you have any questions, or would like me to add in more information, please ask, and I’ll gladly do so. Credits go to:
Coolboyman - Giving me most of the music data format I have here
Data Crystal - Contained a Gold and Red ROM map where I got my offsets
If I forgot you, please tell me.
Fin.

Last edited by hashtag; April 15th, 2010 at 08:17 AM.
Reply With Quote
  #2    
Old September 18th, 2009, 12:45 PM
Pokepal17's Avatar
Pokepal17
More cowbell~
 
Join Date: Oct 2008
Location: Steeltown
Age: 19
Gender: Male
Nature: Modest
Wow, I've always wondered about 1st gen/2nd gen music editing. This is a pretty good tutorial and it'll help a lot of R/B/Y/G/S/C hackers.
__________________
Pokémon Stardrop
Reply With Quote
  #3    
Old September 18th, 2009, 02:33 PM
Pkmn-Master's Avatar
Pkmn-Master
:U
 
Join Date: Jun 2005
Location: Michigan
Age: 20
Nature: Brave
Now we just need somebody to make an easy-to-use editor, like sappy!

I might try this. I'm just not very knowledgeable of Hex.
Reply With Quote
  #4    
Old September 18th, 2009, 08:42 PM
Melash's Avatar
Melash
Back for now.
 
Join Date: May 2008
Location: Idaho
Age: 20
Gender: Male
Nature: Relaxed
Actually, a easy-to-use music editor is an excellent idea. If anyone good at programming has this in mind, I can answer all your questions about music hacking, and give you some extra offsets. As of right now, it takes quite a while to insert new music tracks.
Reply With Quote
  #5    
Old May 8th, 2010, 04:12 AM
Halfshadow's Avatar
Halfshadow
Sono italiano/I'm italian.
 
Join Date: Sep 2008
Location: Lucca ITALY (Yes i'm of Lucca, the city of "Lucca comics and games" !)
Age: 25
Gender: Male
Nature: Docile
Thank you.
I'm a music hacker (GBA) and is very interesting to me.
Reply With Quote
  #6    
Old October 25th, 2010, 02:55 PM
Zee Best
Beginning Trainer
 
Join Date: Oct 2010
Gender: Male
Thanks this was of alot of help, just wrote an extractor =).
Reply With Quote
  #7    
Old October 30th, 2010, 12:37 AM
miksy91's Avatar
miksy91
A GB/C Rom Hacker since 2010
 
Join Date: Oct 2008
Location: A small country in the North
Gender: Male
Nature: Relaxed
Very nice tutorial Melash.
I'll give this a try though I'm not any music composer :D
__________________
My Rom Hack



Hacks I support





Learn how to hack GB/C games:

Check my GameBoy/Color hacking videos in Youtube
-The video set uses Pokemon Silver (U) rom for demonstrations
Reply With Quote
  #8    
Old May 30th, 2013, 10:30 AM
BallMaster's Avatar
BallMaster
HEX cracker
 
Join Date: Jan 2013
Location: Finland
Age: 16
Gender: Male
RB music data:
There's 16 different note lenghts in total. Each gets 1/16 longer than the last,
so here's the complete structure:
Spoiler:
x0= 1/16
x1= 1/8
x2= 1/8+1/16
x3= 1/4
x4= 1/4+1/16
x5= 1/4+1/8
x6= 1/4+1/8+1/16
x7= 1/2
x8= 1/2+1/16
x9= 1/2+1/8
xA= 1/2+1/8+1/16
xB= 1/2+1/4
xC= 1/2+1/4+1/16
xD= 1/2+1/4+1/8
xE= 1/2+1/4+1/8+1/16
xF= 1


D6: play at 2x speed.
D8: play at 1,5x speed.
EC xx: Instrument selection.
FD xx xx: Play at the offset given in the pointer.
FF: end.

How drum data works:
2 bytes for each note.
xy zz-(x: effect (usually B for drums ), y: note lenght, zz: sound type).

Last edited by BallMaster; June 19th, 2013 at 05:11 AM.
Reply With Quote
  #9    
Old July 16th, 2013, 11:18 AM
Uzamaki Nagato's Avatar
Uzamaki Nagato
Pokemon Master
 
Join Date: Jul 2013
Location: Nuvema Town
Gender: Male
Nature: Calm
Your link doesn't work, I'm afraid.

Can you link it to this page, again? Thanks in advance.
Reply With Quote
  #10    
Old October 2nd, 2013, 08:25 AM
daniilS's Avatar
daniilS
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 15
Gender: Male
Hi,

I've asked this question on various places, but nobody seems to know the answer. Is there a tool to export a song from Pokémon RBY (I need it for yellow)? If soundedit can do that, could you please provide a working download link?
Also, if not possible, then where can I find a midi (or any editable format) of the Jessie & James encounter theme from yellow? I really can't find it anywhere, and nobody has it.

Thanks in advance
__________________

Thanks to JPAN, Jambo51, Shiny Quagsire and knizz for teaching me almost everything I know about hacking, through tutorials or in person.
Reply With Quote
  #11    
Old October 23rd, 2013, 04:17 PM
Airikita's Avatar
Airikita
 
Join Date: Oct 2013
Gender: Female
I have found that Velocity actually determines the note length/echo, not the frames. The frames works a lot like Tempo, but controls delay.

In velocity, the z value is the echo, while the y determines length (draw out each note, which can overlap with F):
http://www.youtube.com/watch?v=05NxZ...tailpage#t=343

Quote:
Originally Posted by daniilS View Post
Hi,

I've asked this question on various places, but nobody seems to know the answer. Is there a tool to export a song from Pokémon RBY (I need it for yellow)? If soundedit can do that, could you please provide a working download link?
Also, if not possible, then where can I find a midi (or any editable format) of the Jessie & James encounter theme from yellow? I really can't find it anywhere, and nobody has it.

Thanks in advance
Yeah... um... I seemed to have had difficulty finding the midi converter tool I dug up, and it's not entirely good... I didn't see any exporting tools, sorry. It might be difficult to find one.

I mean... there might be one, idk.

Quote:
E6 xx xx - Tune (not sure what the arguments for this are..)
This controls pitch, the higher the value, the higher the pitch setting on the music.
__________________

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!

Last edited by Airikita; October 24th, 2013 at 12:07 PM.
Reply With Quote
  #12    
Old March 25th, 2014, 06:28 PM
Arctic Eagle's Avatar
Arctic Eagle
Pokemon Trainer/Breeder
 
Join Date: Apr 2013
Location: New Bark Town
Age: 16
Gender: Male
Nature: Brave
Send a message via Skype™ to Arctic Eagle
Yeah, the folks above are correct, the above link is timed out....
....please fix this
__________________
I'm Arctus Platner and I am participating
in the Sinnoh Pokémon League...


...hopefully all goes according to plan...



I still need to find where to register for it...

...and I need to renew my Trainer Card, it's the one from
Hoenn for goodness sake!
Reply With Quote
  #13    
Old April 11th, 2014, 03:07 PM
com3tiin's Avatar
com3tiin
Soy chamber...
 
Join Date: Jan 2013
Gender: Male
Thansk for this information melash!

... but it would be good to have another more updated tutorial to make things easier.
Reply With Quote
  #14    
Old May 25th, 2014, 12:53 PM
Ghostr4z3r
 
Join Date: Mar 2012
Gender: Male
The first byte in the header is for the bpm of the track
Reply With Quote
  #15    
Old 1 Week Ago, 01:01 AM
NearEDGE
 
Join Date: Aug 2014
Gender: Male
Sorry to bump an old thread, but this line here is incorrect:
Quote:
FD 00 ll hh - Jump (this is used to set the loop point for the song, ll = low byte, hh = high byte)
FD XX YYZZ

FD - Loop byte
XX - Number of times to loop, or 00 for infinite.
YYZZ - In-Bank pointer to location of loop.

It's pretty funny to come across a jump to a whole rest that makes the whole audio channel just stop. rofl.

A lot of songs don't end by looping themselves with a call also. A lot tend to end by just jumping back to an earlier point in the song, it will almost always be an infinite loop.

Last edited by NearEDGE; 1 Week Ago at 01:50 AM.
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 03:36 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.