Actions

SCHG

Difference between revisions of "Music Hacking"

From Sonic Retro

(Note editing)
m (Text replacement - "{{SCHGuides}}" to "==References== <references /> {{SCHGuides}}")
 
(148 intermediate revisions by 34 users not shown)
Line 1: Line 1:
=Music Hacking=
+
{{SMPSHackingNav}}
 +
 
 
==Original Credits==
 
==Original Credits==
Guide originally created by [[Tweaker]] on May 25 2005.<br>
+
Guide originally created by [[User:Tweaker|Tweaker]] on May 25 2005.
 +
 
 
Thanks to:
 
Thanks to:
* [[Saxman]] - For cracking the format, hooking me up with loads of info, and making the Sonic 2 hacking guide. The Original Master™.
+
* [[User:Saxman|saxman]]
* [[fuzzbuzz]] - For Sonic 1 stuff and helping me understand a lot of shit I didn't before. Plus, he's ripping apart the Sonic 1 sound driver so Sega can't hide shit from us anymore. It's easier though, because it's in 68K (OSHIT BURN =P). The Sonic 1 Master™.
+
* [[fuzzbuzz]]  
* [[Erik JS]] - Disassembled the S&K sound driver. Nuff said. =P Also gave me a bunch of savestate locations for realtime music editing (which allowed me to find the locations in the ROM. w00t!), and the list of S&K music locations. He's one of those legendary hackers that just drop by once in a while and make your jaw drop because he just shows up with some revolutionary work out of nowhere. By the time you come to, you realize... You just got served. Word up.
+
* [[Erik JS]]
* [[Djbrayster]] - He made the pretty list of Ristar music locations, and is a cool guy in general. Nice work.
+
* [[User:Djbrayster|Djbrayster]]
Sonic 65 - He made the first S3K-S1 port and told me on IRC. This led me to look into it and find out how to correctly port all music (when I couldn’t before). He’s like my apprentice too, so when you can’t get to me for help, you can go to him. =P
+
* [[User:Heran Bago|Heran Bago]]
* [[Heran Bago]] - He made the pretty list of Gunstar Heroes music locations, and he is totally the human bagel who knows how to play the bongos. He’s getting along pretty damn well in the area of music hacking as well. Don’t underestimate him; He’s my nigga.
+
* [[User:SGR|SGR]]
* [[SGR]] - He revealed to me many games that use the S1 driver, and even found pointers and such in each. He’s a very cool guy.
+
* [[User:Tweaker|Tweaker]]
* [[Tweaker|Me]] - I'm just that feckin' awesome, eh? =P I mean seriously, you can't live without this guide. It's the best shit out there. You can't deny it. That is, considering you are interesting in editing music. And I know you are, or you would've never taken a look at this guide. I mean shit, I wrote the damn thing. I am... The New Master™.
 
* [[Sega]] - For making Sonic and letting me exploit their music system. ;)
 
  
 
==Prologue==
 
==Prologue==
You must have at least basic hex knowledge. If you have no idea what hex is, then I suggest you steer clear of this guide and figure things out first. It's also recommended that you read and save a copy of [http://www.smspower.org/maxim/docs/ym2612/index.html the YM2612 technical documentation] and maybe [http://www.smspower.org/maxim/docs/SN76489.txt the PSG documentation] so that you can more easily understand how the voices and coordination flags work.
+
You must have at least basic hex knowledge. If you have no idea what hex is, then I suggest you steer clear of this guide and figure things out first. It's also recommended that you read and save a copy of [http://www.smspower.org/maxim/Documents/YM2612 the YM2612 technical documentation] and maybe [http://www.smspower.org/Development/SN76489 the PSG documentation] so that you can more easily understand how the voices and coordination flags work.
  
 
==Update history==
 
==Update history==
 
* March 29 2005: Initial release.  
 
* March 29 2005: Initial release.  
  
* April 22 2005: Updated Chaotix info. Also added explaination on Sonic 2 Final pointer format and corrected a few bits of incorrect info. Turns out you CAN use 6 FM channels and the DAC at the same time, thanks to the music engine. Can't say it works perfectly though. :P.
+
* April 22 2005: Updated Chaotix info. Also added explanation on Sonic 2 Final pointer format and corrected a few bits of incorrect info. Turns out you CAN use 6 FM channels and the DAC at the same time, thanks to the music engine. Can't say it works perfectly though. :P.
  
* May 24 2005: Updated with even more Sonic 2 final info. Also added music pointer locations for Ristar and Micheal Jackson's Moonwalker.
+
* May 24 2005: Updated with even more Sonic 2 final info. Also added music pointer locations for Ristar and Michael Jackson's Moonwalker.
  
* September ?? 2005: Fucking huge update. Massive amounts of new info, mainly concerning DAC samples. All the DAC sample definitions for Sonic 3 are now availiable, leaving many possibilities in the field. Also, I specified the DAC samples in Sonic 1 and 2 more, so Sonic QX users can be more precise with custom imports. Also, the purpose of two more coordination flags has been found out that have to do with PSG. Then, there are the small changes. A bit of proofreading, clarification... etc. I know I promised realtime music editing this update... Sorry I couldn't get it. It's my next priority, promise. =P
+
* September ?? 2005: Fucking huge update. Massive amounts of new info, mainly concerning DAC samples. All the DAC sample definitions for Sonic 3 are now available, leaving many possibilities in the field. Also, I specified the DAC samples in Sonic 1 and 2 more, so Sonic QX users can be more precise with custom imports. Also, the purpose of two more coordination flags has been found out that have to do with PSG. Then, there are the small changes. A bit of proofreading, clarification... etc. I know I promised realtime music editing this update... Sorry I couldn't get it. It's my next priority, promise. =P
  
 
Some of these random things:
 
Some of these random things:
Line 37: Line 37:
 
Anyway, I finally got the realtime music editing section done. Savestate locations and Z80 RAM equivalents are listed, with explanations on how to tinker with music, even while it’s still playing. Also added locations for a shitload of games, mostly from my notes. I also added more to the music porting section. And once again, various corrections and such... I can't be arsed to keep track of what I change anymore, so bleh. =P
 
Anyway, I finally got the realtime music editing section done. Savestate locations and Z80 RAM equivalents are listed, with explanations on how to tinker with music, even while it’s still playing. Also added locations for a shitload of games, mostly from my notes. I also added more to the music porting section. And once again, various corrections and such... I can't be arsed to keep track of what I change anymore, so bleh. =P
  
==Pointer format==
+
* August 22 2011: updated by kram1024, flamewing and others with all the new info discovered recently about smps by flamewing's most recent disasm of the s&k driver.
First off, what is a pointer? Well, a pointer is a set of hexadecimal values that point to a location in the ROM (or, in other cases, RAM. More advanced stuff there though). There are different types of pointers.
 
 
 
Some are part of an offset index. These kinds of data pointers are usually 16-bits (2 bytes) long and are determined by adding the pointer value to the current location in the ROM. So if one offset index added to $80000, and a pointer read $0890, then it is reading offset $80890, which would be the location of the data it is looking for.
 
 
 
Other pointers are very basic. 32-bit pointers are the easiest to deal with. They are big endian when dealing with the Megadrive and define the exact location using four bytes. So let's use the previous example. Our location was $80890. The pointer appears as "00 08 08 90". Couldn't be any simpler.
 
 
 
The pointer format in the Sonic games music differs from game to game. I will list the pointer format for each incarnation of the music engine. Follow along.
 
 
 
===Sonic 1, Ristar, and Moonwalker===
 
These pointers are relatively easy to deal with. These pointers are like the offset index pointers talked about earlier. They are relative 16-bit pointers that add the pointer value to the current location in the ROM. Here is an example.
 
 
 
Lets say that the music data started at $EC000. Now, our voice pointer says 0180. So, from $EC000 we add 180 to the value, making the location of the voice data at $EC180. You see? That is simple. There are some other things to note about these pointers that I will mention later that have to do with coordination flags.
 
 
 
NOTE: Ristar's coordination flag pointers have $1 added to them, compared to the pointers in Sonic 1 and etc. If you want to convert between the two, just add or subtract $1 thusly.
 
 
 
===Sonic 2 Beta, 3, Crackers, Chaotix and 3D===
 
These pointers are also pretty easy to deal with, once you understand their format. These pointers are also 16-bit, but they are absolute pointers. This means that they add to a specified location, which is usually even. Now, what you must understand is that these pointers are little endian, because the sound driver runs on the Z80. Little endian simply means that the bytes are swapped. A good example would be if a location was 8180 (big endian) for voice data, the pointer would read 8081 (little endian). This may seem confusing at first, but I will explain further.
 
 
 
You see, these pointers always read "8000", regardless of the starting location. So if the starting location of the music was $C0000 for one song, and the starting location of another was C8000, the resulting pointer would still be $0080. You see, $8000 bytes is one music bank. So when 8000 bytes are used up by the first bank of music data, the second set of music pointers will add to that second bank location. So if the first bank's location was $C0000, and the second was $C8000, then the first set of pointers would add to $C0000, and the second to $C8000. Not too complicated. So let's break things down now.
 
 
 
Lets say the voice pointer for one song was $F289. Since these are little endian, swap the bytes. This makes $89F2. Now, lets say that the current bank adds to $C8000. So we can deduce that the location of the voice data is $C89F2. You get it now? It is easier to find things with these pointers, but it becomes a bit of a problem if you are porting music, since you have to either put the music in its "original" location or fix all the pointers in the song.
 
 
 
===Sonic 2 Final===
 
All pointers add to a certain constant, including those in coordination flags. This constant is $1380. With these pointers, $1380 acts as zero. So lets say that the voice pointer reads $1915. Since $1380 is zero, we would subtract $1380 from $1915 and we get the distance away from the beginning of the song that the voice data is. Essentially the pointers in Sonic 2 Beta, but with a different constant. Note that each song is treated as it's own bank, and the beginning of the song is the beginning of the bank, while the end of the song is the end of the bank.
 
 
 
====Exceptions====
 
Credits music is uncompressed, unlike all the other music. Uses the S2B pointer format. So do the pointers to the music data itself at $F8000.
 
 
 
==Header format==
 
===Sonic 1, Sonic 2, Sonic 3, Sonic & Knuckles, Sonic 3D Blast, and Sonic Crackers===
 
 
 
All pointers in this section differ according to the game you are hacking. Remember, relative for Sonic 1, Ristar, and Moonwalker, and absolute little endian for the others. The music header format listed is a universal format used in all the major Megadrive Sonic games, including Sonic 1, Sonic 2, Sonic 3, Sonic & Knuckles, Sonic 3D Blast, and Sonic Crackers.
 
 
 
{|border="1"
 
! Word offset||Description
 
|-
 
| $00-$01
 
| Voice pointer. This points to the location of the voice data, or instruments in the song.
 
|-
 
| $02-$03
 
| Channel setup. This is usually 0603, and means there are 5 FM channels, 1 DAC, and 3 PSG channels. Changing these bytes will either make the header larger or smaller, depending on what you change them to. If you want to use the 6th FM channel, the 6th FM channel will be located after the 5th FM channel modifier. The same applies if you decide to use the PSG noise channel. It will be located right after the instrument modifier for the 3rd PSG modifier.
 
|-
 
| $04-$05
 
| Tempo modifier. First byte is the dividing timing, and the second is the main tempo modifier. Change the second byte to make the music faster or slower.
 
|-
 
| $06-$07
 
| DAC pointer. This points to the drums you hear in the music. In Chaotix, this has no function - in fact, it doesn't even exist. The header just starts with FM channel 1.
 
|-
 
| $08-$09
 
| Unused/Redundant.
 
|-
 
| $0A-$0B
 
| FM channel 1 pointer. It points to FM channel 1.
 
|-
 
| $0C-$0D
 
| FM channel 1 modifier. First byte modifies pitch, and second byte modifies volume (same for all).
 
* NOTE: Volume works "backwards" - the lower the value, the higher the volume.
 
|-
 
| $0E-$0F
 
| FM channel 2 pointer.
 
|-
 
| $10-$11
 
| FM channel 2 modifier
 
|-
 
| $12-$13
 
| FM channel 3 pointer.
 
|-
 
| $14-$15
 
| FM channel 3 modifier.
 
|-
 
| $16-$17
 
| FM channel 4 pointer.
 
|-
 
| $18-$19
 
| FM channel 4 modifier.
 
|-
 
| $1A-$1B
 
| FM channel 5 pointer.
 
|-
 
| $1C-$1D
 
| FM channel 5 modifier.
 
|-
 
| $1E-$1F
 
| PSG channel 1 pointer.
 
|-
 
| $20-$21
 
| PSG channel 1 modifier.
 
|-
 
| $22-$23
 
| Current PSG 1 instrument. First byte is redundant. Change the value to change the sound of the PSG tone produced.
 
|-
 
| $24-$25
 
| PSG channel 2 pointer.
 
|-
 
| $26-$27
 
| PSG channel 2 modifier.
 
|-
 
| $28-$29
 
| Current PSG 2 instrument.
 
|-
 
| $2A-$2B
 
| PSG channel 3 pointer.
 
|-
 
| $2C-$2D
 
| PSG channel 3 modifier.
 
|-
 
| $2E
 
| Current PSG 3 Instrument.
 
|}
 
 
 
===Knuckles Chaotix===
 
The format for the Chaotix music pointers is slightly different to accommodate  the 32x's hardware.
 
 
 
{|border="1"
 
!Word offset||Description
 
|-
 
| $00-$01
 
| Voice pointer. This points to the location of the voice data, or instruments in the song.
 
|-
 
| $02-$03
 
| Channel setup. This is usually 0603, and means there are 6 FM channels, and 3 PSG channels. Changing these bytes will either make the header larger or smaller, depending on what you change them to. If you decide to use the 4th PSG channel, it will be located right after the instrument modifier for the PSG 3 modifier. Following that will be the PWM pointers.
 
|-
 
| $04-$05
 
| Tempo modifier. First byte is the dividing timing, and the second is the main tempo modifier. Change the second byte to make the music faster or slower.
 
|-
 
| $06-$07
 
| FM channel 1 pointer. It points to FM channel 1.
 
|-
 
| $08-$09
 
| FM channel 1 modifier. First byte modifies pitch, and second byte modifies volume (same for all).
 
* NOTE: Volume works "backwards" - the lower the value, the higher the volume.
 
|-
 
| $0A-$0B
 
| FM channel 2 pointer.
 
|-
 
| $0C-$0D
 
| FM channel 2 modifier.
 
|-
 
| $0E-$0F
 
| FM channel 3 pointer.
 
|-
 
| $10-$11
 
| FM channel 3 modifier.
 
|-
 
| $12-$13
 
| FM channel 4 pointer.
 
|-
 
| $14-$15
 
| FM channel 4 modifier.
 
|-
 
| $16-$17
 
| FM channel 5 pointer.
 
|-
 
| $18-$19
 
| FM channel 5 modifier.
 
|-
 
| $1A-$1B
 
| FM channel 6 pointer.
 
|-
 
| $1C-$1D
 
| FM channel 6 modifier.
 
|-
 
| $1E-$1F
 
| PSG channel 1 pointer.
 
|-
 
| $20-$21
 
| PSG channel 1 modifier.
 
|-
 
| $22-$23
 
| Current PSG 1 instrument. First byte is redundant. Change the value to change the sound of the PSG tone produced.
 
|-
 
| $24-$25
 
| PSG channel 2 pointer.
 
|-
 
| $26-$27
 
| PSG channel 2 modifier.
 
|-
 
| $28-$29
 
| Current PSG 2 instrument.
 
|-
 
| $2A-$2B
 
| PSG channel 3 pointer.
 
|-
 
| $2C-$2D
 
| PSG channel 3 modifier.
 
|-
 
| $2E-$2F
 
| Current PSG 3 instrument.
 
|-
 
| $30-$31
 
| PWM channel 1 pointer.
 
|-
 
| $32-$33
 
| PWM channel 1 modifier.
 
|-
 
| $34-$35
 
| PWM channel 2 pointer.
 
|-
 
| $36-$37
 
| PWM channel 2 modifier.
 
|-
 
| $38-$39
 
| PWM channel 3 pointer.
 
|-
 
| $3A-$3B
 
| PWM channel 3 modifier.
 
|-
 
| $3C-$3D
 
| PWM channel 4 pointer.
 
|-
 
| $3E-$3F
 
| PWM channel 4 modifier.
 
|}
 
 
 
Understanding the header is essential to editing music. This is the basis of basic music editing, such as pitch and tempo editing. Once you understand the pointers and the header, then you are ready to start learning more advanced things.
 
 
 
==Voice editing==
 
Voices are the instruments that you hear playing in the music throught the FM channels. To edit them correctly, you need to know FM synthesis. Swapping and copying voices is a simple copy-paste job. A voice is 19 hex bytes, and has no header. It is raw data that gives info to the YM2612 FM chip in the Megadrive to give the desired sound output. The format of a voice is as follows.
 
 
 
{|border="1"
 
! rowspan="2" | Offset
 
! rowspan="2" | Description
 
! colspan="3" | Register
 
|-
 
! Ch.1/3||Ch.2/4||Ch.3/6
 
|-
 
| $0
 
| Feedback (next 3 bits) / Algorithm (lower 3 bits)
 
| B0 || B1 || B2
 
|-
 
| $1
 
| Detune of operator 4 (nybble 1) / Coarse-frequency of operator 4 (nybble 2)
 
| 3C || CD || CE
 
|-
 
| $2
 
| Detune of operator 3 (nybble 1) / Coarse-frequency of operator 3 (nybble 2)
 
| 38 || 39 || 3A
 
|-
 
| $3
 
| Detune of operator 2 (nybble 1) / Coarse-frequency of operator 2 (nybble 2)
 
| 34 || 35 || 36
 
|-
 
| $4
 
| Detune of operator 1 (nybble 1) / Coarse-frequency of operator 1 (nybble 2)
 
| 30 || 31 || 32
 
|-
 
| $5
 
| [RS] of operator 4 (upper 2 bits) / Attack rate [AR] of operator 4 (lower 5 bits)
 
| 5C || 5D || 5E
 
|-
 
| $6
 
| [RS] of operator 3 (upper 2 bits) / Attack rate [AR] of operator 3 (lower 5 bits)
 
| 58 || 59 || 5A
 
|-
 
| $7
 
| [RS] of operator 2 (upper 2 bits) / Attack rate [AR] of operator 2 (lower 5 bits)
 
| 54 || 55 || 56
 
|-
 
| $8
 
| [RS] of operator 1 (upper 2 bits) / Attack rate [AR] of operator 1 (lower 5 bits)
 
| 50 || 51 || 52
 
|-
 
| $9
 
| [AM] of operator 4 / First decay rate [D1R] of operator 4 (lower 5 bits)
 
| 6C || 6D || 6E
 
|-
 
| $A
 
| [AM] of operator 3 / First decay rate [D1R] of operator 3 (lower 5 bits)
 
| 68 || 69 || 6A
 
|-
 
| $B
 
| [AM] of operator 2 / First decay rate [D1R] of operator 2 (lower 5 bits)
 
| 64 || 65 || 66
 
|-
 
| $C
 
| [AM] of operator 1 / First decay rate [D1R] of operator 1 (lower 5 bits)
 
| 60 || 61 || 62
 
|-
 
| $D
 
| Second decay rate [D2R] of operator 4
 
| 7C || 7D || 7E
 
|-
 
| $E
 
| Second decay rate [D2R] of operator 3
 
| 78 || 79 || 7A
 
|-
 
| $F
 
| Second decay rate [D2R] of operator 2
 
| 74 || 75 || 76
 
|-
 
| $10
 
| Second decay rate [D2R] of operator 1
 
| 70 || 71 || 72
 
|-
 
| $11
 
| First decay level [D1L] of operator 4 (nybble 1) / Release rate [RR] of operator 4 (nybble 2)
 
| 8C || 8D || 8E
 
|-
 
| $12
 
| First decay level [D1L] of operator 3 (nybble 1) / Release rate [RR] of operator 3 (nybble 2)
 
| 88 || 89 || 8A
 
|-
 
| $13
 
| First decay level [D1L] of operator 2 (nybble 1) / Release rate [RR] of operator 2 (nybble 2)
 
| 84 || 85 || 86
 
|-
 
| $14
 
| First decay level [D1L] of operator 1 (nybble 1) / Release rate [RR] of operator 1 (nybble 2)
 
| 80 || 81 || 82
 
|-
 
| $15
 
| Total level of operator 4
 
| 4C || 4D || 4E
 
|-
 
| $16
 
| Total level of operator 3
 
| 48 || 49 || 4A
 
|-
 
| $17
 
| Total level of operator 2
 
| 44 || 45 || 46
 
|-
 
| $18
 
| Total level of operator 1
 
| 40 || 41 || 42
 
|}
 
 
 
==Note editing==
 
The way the music is set up in the Sonic games is similar to how music is structured in a MIDI file. Here are some values that will help you directly edit notation data in the music.
 
 
 
* $00-$7F: Note duration (How long a note is held for)
 
* $80-$DF: Notes (80 is a rest)
 
Specifics…
 
* $81 - C
 
* $82 - C#/Db
 
* $83 - D
 
* $84 - D#/Eb
 
* $85 - E
 
* $86 - F
 
* $87 - F#/Gb
 
* $88 - G
 
* $89 - G#/Ab
 
* $8A - A
 
* $8B - A#/Bb
 
* $8C - B
 
* $8D - 1C
 
* $8E - 1C#/Db
 
* $8F - 1D
 
* $90 - 1D#/Eb
 
* $91 - 1E
 
* $92 - 1F
 
* $93 - 1F#/Gb
 
* $94 - 1G
 
* $95 - 1G#/Ab
 
* $96 - 1A
 
* $97 - 1A#/Bb
 
* $98 - 1B
 
* $99 - 2C
 
* $9A - 2C#/Db
 
* $9B - 2D
 
* $9C - 2D#/Eb
 
* $9D - 2E
 
* $9E - 2F
 
* $9F - 2F#/Gb
 
* $A0 - 2G
 
* $A1 - 2G#/Ab
 
* $A2 - 2A
 
* $A3 - 2A#/Bb
 
* $A4 - 2B
 
* $A5 - 3C
 
* $A6 - 3C#/Db
 
* $A7 - 3D
 
* $A8 - 3D#/Eb
 
* $A9 - 3E
 
* $AA - 3F
 
* $AB - 3F#/Gb
 
* $AC - 3G
 
* $AD- 3G#/Ab
 
* $AE - 3A
 
* $AF - 3A#/Bb
 
* $B0 - 3B
 
* $B1 - 4C
 
* $B2 - 4C#/Db
 
* $B3 - 4D
 
* $B4 - 4D#/Eb
 
* $B5 - 4E
 
* $B6 - 4F
 
* $B7 - 4F#/Gb
 
* $B8 - 4G
 
* $B9 - 4G#/Ab
 
* $BA - 4A
 
* $BB - 4A#/Bb
 
* $BC - 4B
 
* $BD - 5C
 
* $BE - 5C#/Db
 
* $BF - 5D
 
* $C0 - 5D#/Eb
 
* $C1 - 5E
 
* $C2 - 5F
 
* $C3 - 5F#/Gb
 
* $C4 - 5G
 
* $C5 - 5G#/Ab
 
* $C6 - 5A
 
* $C7 - 5A#/Bb
 
* $C8 - 5B
 
* $C9 - 6C
 
* $CA - 6C#/Db
 
* $CB - 6D
 
* $CC - 6D#/Eb
 
* $CD - 6E
 
* $CE - 6F
 
* $CF - 6F#/Gb
 
* $C0 - 6G
 
* $D1 - 6G#/Ab
 
* $D2 - 6A
 
* $D3 - 6A#/Bb
 
* $D4 - 6B
 
* $D5 - 7C
 
* $D6 - 7C#/Db
 
* $D7 - 7D
 
* $D8 - 7D#/Eb
 
* $D9 - 7E
 
* $DA - 7F
 
* $DB - 7F#/Gb
 
* $DC - 7G
 
* $DD - 7G#/Ab
 
* $DE - 7A
 
* $DF - 7A#/Bb
 
 
 
* $E0-$FF: Coordination flags
 
 
 
Now, the DAC channel uses values starting with 81 (As with FM and PSG, 80 is used as a rest) to define the DAC drum sample that is played. Here are the sample definitions for a few games. Expect this section to be updated with more soon.
 
 
 
===Sonic 1===
 
* $81: Kick
 
* $82: Snare
 
* $83: Hi-Timpani
 
* $84: Noise
 
* $85: Noise
 
* $86: Noise
 
* $87: Sega Sound
 
* $88: Hi-Timpani
 
* $89: Mid-Timpani
 
* $8A: Low-Timpani
 
* $8B: Low-Timpani
 
 
 
===Sonic 2 Beta===
 
* $81: Kick
 
* $82: Snare
 
* $83: Clap
 
* $84: Scratch
 
* $85: Hi-Timpani
 
* $86: Hi-Tom
 
* $87: Silent
 
* $88: Hi-Timpani
 
* $89: Mid-Timpani
 
* $8A: Low-Timpani
 
* $8B: Low-Timpani
 
* $8C: Mid-Tom
 
* $8D: Low-Tom
 
* $8E: Floor-Tom
 
* $8F: Clap
 
 
 
===Sonic 2 Final===
 
* $81: Kick
 
* $82: Snare
 
* $83: Clap
 
* $84: Scratch
 
* $85: Timpani
 
* $86: Tom
 
* $87: Bongo
 
* $88: Hi-Timpani
 
* $89: Mid-Timpani
 
* $8A: Low-Timpani
 
* $8B: Low-Timpani
 
* $8C: Mid-Tom
 
* $8D: Low-Tom
 
* $8E: Floor-Tom
 
* $8F: Hi-Bongo
 
* $90: Mid-Bongo
 
* $91: Low-Bongo
 
 
 
===Sonic 3 and Knuckles/Sonic 3D Blast===
 
* $81: Snare
 
* $82: High-Tom
 
* $83: Mid-Tom
 
* $84: Low-Tom
 
* $85: Floor Tom
 
* $86: Kick
 
* $87: Muffled Snare
 
* $88: Crash Cymbal
 
* $89: Ride Cymbal(?)
 
* $8A: Low Metal Hit
 
* $8B: Metal Hit
 
* $8C: High Metal Hit
 
* $8D: Higher Metal Hit
 
* $8F: Clap
 
* $90: Electric High-Tom
 
* $91: Electric Mid-Tom
 
* $92: Electric Low-Tom
 
* $93: Electric Floor Tom
 
* $94: Tight Snare
 
* $95: Mid-pitch Snare
 
* $96: Loose Snare
 
* $97: Looser Snare
 
* $98: Hi-Timpani
 
* $99: Low-Timpani
 
* $9A: Mid-Timpani
 
* $9B: Quick Loose Snare
 
* $9C: Click
 
* $9D: Power Kick
 
* $9E: Quick Glass Crash
 
* $9F: Glass Crash with Snare
 
* $A0: Glass Crash
 
* $A1: Glass Crash with Kick
 
* $A2: Quiet Glass Crash
 
* $A3: Odd Snare with Kick
 
* $A4: Kick with extra bass
 
* $A5: "Come on!"
 
* $A6: Dance Snare
 
* $A7: Loose Kick
 
* $A8: Moderately Loose Kick
 
* $A9: "Woo!"
 
* $AA: "Go!"
 
* $AB: Snare with voice going "Go!"
 
* $AC: Power Tom
 
* $AD: Hi-Wood Block
 
* $AE: Low-Wood Block
 
* $AF: Hi-Hit Drum
 
* $B0: Low-Hit Drum
 
* $B1: Metal Crash Hit
 
* $B2: Echoed Clap Hit
 
* $B3: Lower Echoed Clap Hit
 
* $B4: Hip-Hop style hit with a kick
 
* $B5: Hip-Hop style hit with a Power Kick
 
* $B6: Some Bass with a voice going "Hey!"
 
* $B7: Dance Style Kick
 
* $B8: Hip-Hop hit with a kick
 
* $B9: Hip-Hop hit with a kick
 
* $BA: Reverse Fading Wind Sound
 
* $BB: Scratch
 
* $BC: Loose Snare with noise
 
* $BD: Power Kick
 
* $BE: Crashing noise with voice going "Woo!"
 
* $BF: Quick Hit
 
* $C0: Kick with a voice going "Hey!"
 
* $C1: Power Kick with hit
 
* $C2: Low Power Kick with hit
 
* $C3: Lower Power Kick with hit
 
* $C4: Lowest Power Kick with hit
 
 
 
Note: Some may be missing or changed in 3D, such as most SFX. The major drums are there though.
 
 
 
===Sonic Crackers===
 
* $81: Kick
 
* $82: Snare
 
* $83: Tom
 
* $84: Tom
 
* $85: Tom
 
* $86: Voice sample "Let's go!"
 
* $87: Voice sample "Hey!"
 
* $88: Beep/screech
 
 
 
==DAC Samples==
 
DAC samples are raw PCM samples, generally used for drums and voices that you hear in game. You can customize these audio samples to your needs. Here is some information to do so below...
 
 
 
===Audio Compression===
 
Samples are all "compressed" to 4-bit PCM data in the ROM itself, and are decompressed and converted to 8-bit PCM once processed in-game. You can decompress (and recompress) samples by using [[jman2050]]'s Sonic 1 sample decompressor (though it works for all SMPS games), located [http://www.s2beta.com/forums/index.php?showtopic=6898 here.]
 
 
 
===Sonic 1===
 
Samples in Sonic 1 are inside the Z80 portion of the sound driver, located at $72E7C, and compressed in Kosinski format. All following locations are for the decompressed sound driver.
 
====DAC Sample Pointers====
 
* DAC sample setup index: $D6
 
 
 
Each DAC pointer is listed one after another, and a single entry for one DAC sample is $8 bytes. The format is as follows:
 
{|border="1"
 
|-
 
! Offset||Size||Description
 
|-
 
|$00-$01||Word||Location of the DAC sample in decompressed driver.
 
* NOTE: Value is little endian, so swap the bytes to get the real value.
 
|-
 
|$02-$03||Word||Size of the compressed DAC sample in decompressed driver.
 
* NOTE: Value is little endian, so swap the bytes to get the real value.
 
|-
 
|$05||Byte||Sample rate/pitch. The lower the value, the faster the sample will play.
 
|-
 
|$06-$08||3 Bytes||Unused/redundant.
 
|}
 
 
 
 
 
Sonic 1 has 3 DAC sample slots - one for the kick, one for the snare, and one for the Timpani. The other pitches of Timpani ($88-$8B) are defined by a special table, located at $71CC4, and are fully editable to suit other samples using the Timpani slot ($83).
 
 
 
===Sonic 2===
 
====DAC Sample Pointers====
 
 
 
* Pointers to DAC Samples in Sonic 2 Beta: $ECDA6
 
 
 
 
 
Specifics...
 
* $ECDA6 - Sample 81 pointer
 
* $ECDA8 - Sample 81 length
 
* $ECDAA - Sample 82 pointer
 
* $ECDAC - Sample 82 length (skip FF)
 
* $ECDAF - Sample 83 pointer
 
* $ECDB1 - Sample 83 length
 
* $ECDB3 - Sample 84 pointer
 
* $ECDB5 - Sample 84 length (skip FF)
 
* $ECDB8 - Sample 85 pointer
 
* $ECDBA - Sample 85 length
 
* $ECDBC - Sample 86 pointer
 
* $ECDBE - Sample 86 length -- This one is tricky. You need to skip the second FF, as the first FF is valid.
 
 
 
 
 
 
 
* Pointers to DAC Samples in Sonic 2 Final: $ECF7C
 
Specifics...
 
* $ECF7C - Sample 81 pointer
 
* $ECF7E - Sample 81 length
 
* $ECF81 - Sample 82 pointer
 
* $ECF83 - Sample 82 length
 
* $ECF85 - Sample 83 pointer
 
* $ECF87 - Sample 83 length
 
* $ECF8A - Sample 84 pointer
 
* $ECF8C - Sample 84 length
 
* $ECF8E - Sample 85 pointer
 
* $ECF90 - Sample 85 length
 
* $ECF93 - Sample 86 pointer
 
* $ECF95 - Sample 86 length
 
* $ECF97 - Sample 87 pointer
 
* $ECF99 - Sample 87 length
 
 
 
These pointers are 4 bytes in size. First two bytes are the pointer to the sample (the pointers add to E0000, little endian, and don't follow the music pointer format. Simple 16-bit absolute), and the other two bytes are the length of the sample (also little endian). If you see an FF, skip it and move on to the next byte.
 
 
 
 
 
====DAC Master List====
 
* DAC Master List in Sonic 2 Beta: $ECDC1
 
* DAC Master List in Sonic 2 Final: $ECF9C
 
 
 
These work similarly to the master playlist in concept.. The format is two bytes per sample. First byte defines the sample ID, and the second byte defines the rate that the sample is played at. The lower the rate value, the faster the sample is played. This is used to make certain samples (like toms) appear to have different pitches (high tom, low tom, etc). If you see an FF, skip it and move on to the next byte. If you touch the FF, you fuck the entire sound driver. Don't. :P
 
 
 
===Sonic 3===
 
====Setup Pointers====
 
* DAC $81-$9A Pointer Index (Adds to $E0000): $E0000
 
* DAC $9B-$AA Pointer Index (Adds to $E8000): $E8000
 
* DAC $AB-$C0 Pointer Index (Adds to $F0000): $F0000
 
 
 
These pointer indexes work by pointing to the sample setup data for the particular samples. You'll notice there are 3 pointer indexes - this is since not all the samples can fit in a single bank, so they span 3 banks. The pointers are repeated at all 3 indexes, but only the defined samples for the index (listed above) will be in the relevant ROM bank.
 
 
 
====DAC Sample Setup Format====
 
The format for a DAC sample entry is pretty simple. Follow along:
 
{|border="1"
 
|-
 
! Offset||Size||Function
 
|-
 
|$00||Byte||Sample rate/pitch. The lower the value, the faster the sample will play.
 
|-
 
|$01-$02||Word||Size of the DAC sample, in bytes.
 
* NOTE: Value is little endian, so remember to swap the bytes to get the real value.
 
|-
 
|$03-$04||Word||Pointer to the DAC sample, within the current bank.
 
* NOTE: Value is little endian, so remember to swap the bytes to get the real value.
 
|}
 
 
 
==Coordination flags==
 
Coordination flags alter the music in real time. They are what tell the game to jump from one part of the song to another and to set up the channels. They are also what makes the music loop in the games. They are complicated, and it is recommended that you understand the YM2612 more before messing with them.
 
 
 
The coordination flags differ from game to game. They are the same in Sonic 1 and 2, but different in the others. For now, I will only give the flags for Sonic 1 and 2. Not all of them are known, but a majority are.
 
 
 
* $E0xx - panning, AMS, FMS
 
** xx - Value
 
***Bit 7 - Left channel status
 
***Bit 6 - Right channel Status
 
***Bit 5-3 - AMS
 
***Bit 2 - 0
 
***Bit 1-0 - FMS
 
* $E1xx - Alter note values by xx???
 
* $E6xx - Change channel volume with xx; xx is signed
 
* $E7xx - prevent next note from attacking
 
* $E8xx - set note fill amount to xx
 
* $E9xx - add xx to channel key
 
* $EAxx - set music tempo to xx
 
* $EBxx - Change Tempo Modifier to xx for ALL channels
 
* $ECxx - Change channel volume by xx; xx is signed
 
* $EE - Something with Voice Selection
 
* $EFxx - set voice selection to xx
 
* $F0wwxxyyzz - modulation
 
** ww - Wait for ww period of time before modulation starts
 
** xx - Modulation Speed
 
** yy - Modulation change per Mod. Step
 
** zz - Number of steps in modulation
 
* $F1 - Turn on modulation
 
* $F2 - stop the track
 
* $F3xx - Change current PSG noise to xx (For noise channel)
 
** Applicable values are E0 - E7
 
** Anything beyond E7 will wrap back to the E0 waveform
 
* $F4 - Turn off modulation
 
* $F5xx - Change current PSG tone to xx
 
* $F6yyyy - jump to position yyyy
 
* $F7xxyyyy - repeat xx times at position yyyy before moving on
 
* $F8yyyy - jump to position yyyy (keep previous position in memory for returning)
 
* $F9 - return
 
 
 
====Note on $F3 and $F5====
 
These determine whether a PSG channel is a tone channel or the noise channel. There is only one noise channel, and 3 tone channels. $F3 for noise, $F5 for tone.
 
 
 
====Note on $F8 and $F9====
 
I like to refer to these as the music editing equivalents of JSR and RTS. $F8 adds the previous location to stack and branches to the specified location. $F9 will return to the previous address on stack. Just like 68k, eh? =P
 
 
 
====Further Explanation====
 
Now, you will notice that some of these flags speak of a signed value. Signed values have the capability to be positive or negative.  What makes a hexadecimal value signed?  Bit number 7, the first bit on the left, will be 1 for negative and 0 for positive.  So, a hexadecimal value that is $00-$7F is positive, and values $80-$FF are negative.  Here's an example:
 
 
 
Let's say that you wanted to go back 9 bytes to locate some music data in Sonic 1. Sonic 1 uses relative pointers, so let's use a signed value. With signed bytes, $FFFF is the lowest value you can have. $FFFF resembles zero. So $FFFE would be $-1, $FFFD would be -2, etc. Signed values are used to locate data before the current location. So if I wanted to locate data that was 9 bytes back from my current location, I would take $FFFF and subtract $9 bytes in hex from it. This leaves me with $FFF6. If you wanted to go forward $9 bytes, you would take $FFFF and add $9 to it (while keeping it 16-bit), which would be $0008.  This is confusing, and kinda advanced, but if you plan on learning 68k ASM at all, it's something you have to know.
 
 
 
==Game Specifics==
 
===Sonic 2===
 
====Master Playlist====
 
Sonic 2 has a special "master playlist" that defines what music ID plays in what slot. It works by taking a base address - generally the start of a music bank - and, for each increment of the value, it reads ahead another word in the current ROM bank. So, say, $00 would be the first word in the bank ($00-$01), $01 would be the next ($02-$03), and so on. The base address for this bank, in both Sonic 2 Beta AND final, is $F0000, and the addressing range spans as far as the value can allow, which is two Z80 ROM banks ($10000 bytes). 
 
 
 
However, as a simple guide to understanding how it works (at least, for the casual hacker), all values for the original, untouched music (for the most part, anyway) subtract $1 from the value. So, to change Track 81 to Track 82, change $80 to $81. $80 is $81, $81 is $82, etc. These values go up to slot $9F, or $1F (visually, anyway - the game still uses $80 > values internally) in the final version of the game. The only exception to this is in Sonic 2 Beta, where some songs use the upper $8000 bytes of the bank start address to store music (making the values for calling said music start with $00). The locations for the master playlist are as follows:
 
 
 
* Master Playlist in Sonic 2 Beta: $ECE9F
 
 
 
* Master Playlist in Sonic 2 Final: $ECF36
 
 
 
As previously mentioned, track 81 is represented by $80, 82 is reresented by $81, etc. If you see an $FF, skip it and move on to the next byte - these are compression bytes for the driver, and touching them will bork the decompressor in-game, and prevent the sound driver from booting. The "master playlist" is only in Sonic 2 (Beta/Final) as far as I know. If I find it in any other games, I will update this section.
 
 
 
====Music Compression====
 
In Sonic 2 Final, there is a compression applied to all music data in the game except for the credits. This format has been dubbed the Saxman compression, named after the person who cracked the format. I will not note how to manually decompress this format -- Refer to Saxman's hacking guide to do so. The music can be decompressed by using Magus' Sega Data Compressor. Refer to the pointer format to edit the music properly.
 
 
 
===Sonic 3===
 
====Universal Voice Bank====
 
In Sonic 3, some games have the value "$D817" as their voice pointer. When a song has this in its voice pointer, that means it's being prepped to use a global set of multiple voices that any song in the game can use. This is generally used to save space for songs that use the same voices. Interestingly enough, though, the Special Stage music has the first 5 voices used in the Universal Voice Bank, and all in the same order, so it's puzzling why they didn't just have the song use the bank (as it's fully capable of doing so).
 
 
 
* Universal Voice Bank in Sonic 3: $E77D8
 
 
 
=====Universal Voice Bank definitions=====
 
Using the Universal Voice Bank is akin to using voices in a normal song - each voice has a value, defined by coordination flag $EF. Here are some of the voices used in the Universal Voice Bank.
 
 
 
{|border="1"
 
|-
 
! Value||Description
 
|-
 
|$00||Moog Bass
 
|-
 
|$01||Odd clicking Horn
 
|-
 
|$05||Xylophone
 
|-
 
|$06||Trumpet
 
|-
 
|$07||Odd Stringlike Voice
 
|-
 
|$08||Bell Horn
 
|-
 
|$11||Flat Synth Bass
 
|-
 
|$22||Modulated String Bass
 
|}
 
 
 
==Realtime Music Editing==
 
 
 
By editing values in savestates, you can edit music, pointers and other various values in realtime. Re-load the savestate to see your changes applied!
 
 
 
===Sonic 3/Sonic & Knuckles===
 
{|border="1"
 
|-
 
! Offset||Z80 RAM Location||Purpose
 
|-
 
|$001A8C||1618||Music Pointers (Sonic & Knuckles
 
|-
 
|$001A8E||161A||Music Pointers (Sonic 3)
 
|-
 
|$001778||1304||Pointer for Music Pointers
 
|-
 
|$00177A||1306||Pointer for Sound Effect Pointers
 
|-
 
|$001AF2||167E||Sound Effect Pointers
 
|}
 
 
 
===Sonic 3D===
 
{|border="1"
 
|-
 
! Offset||Z80 RAM Location||Purpose
 
|-
 
|$001AD0||165C||Music Pointers
 
|-
 
|$001778||1304||Pointer for Music Pointers
 
|-
 
|$00177A||1306||Pointer for Sound Effect Pointers
 
|-
 
|$001AD0||165C||Music Pointers
 
|-
 
|$001B34||16C0||Sound Effect Pointers
 
|}
 
 
 
===Sonic 2 Final===
 
{|border="1"
 
|-
 
! Offset||Z80 RAM Location||Purpose
 
|-
 
|$001669||11F5||Master Playlist
 
|-
 
|$000C16||07A2||Pointer for Master Playlist
 
|-
 
|$000DF9||0985||Pointer for Sound Effects list
 
|}
 
 
 
==Music Locations==
 
Now that you know all the basics, you can start editing music. Here are some locations for various games that will help. You can use the music pointers to locate the music data for now, but I may document the locations of each individual track in the future.
 
 
 
===Sonic 1===
 
* Music Pointers: $71A9C
 
* Sound Effect Pointers: $78B44
 
 
 
===Sonic 2 Beta===
 
* Music Pointers (These add to $F0000, for 98-9F): $F0000
 
* Music Pointers (These add to $F8000): $F8000
 
** Pointer to Music Pointers at $F8000: $EC79D
 
* Sound Effect Pointers (These add to $F8000): $FF000
 
** Pointer to Sound Effect Pointers: $EC08E
 
 
 
===Sonic 2 Final===
 
* Music Pointers (These add to F8000): F8000
 
** Specifics...
 
{|border="1"
 
! Pointer ID||Address||Sound Test ID||Song name
 
|-
 
| 81
 
| $F84F6
 
| 08
 
| Casino Night Zone (2 Player)
 
|-
 
| 82
 
| $F88C4
 
| 02
 
| Emerald Hill Zone
 
|-
 
| 83
 
| $F8DEE
 
| 05
 
| Metropolis Zone
 
|-
 
| 84
 
| $F917B
 
| 09
 
| Casino Night Zone
 
|-
 
| 85
 
| $F9664
 
| 0B
 
| Mystic Cave Zone
 
|-
 
| 86
 
| $F9A3C
 
| 03
 
| Mystic Cave Zone (2 Player)
 
|-
 
| 87
 
| $F9D69
 
| 07
 
| Aquatic Ruin Zone
 
|-
 
| 88
 
| $FA36B
 
| 0A
 
| Death Egg Zone
 
|-
 
| 89
 
| $FA6ED
 
| 12
 
| Special Stage
 
|-
 
| 8A
 
| $FAAC4
 
| 11
 
| Option Screens
 
|-
 
| 8B
 
| $FAC3C
 
| 15
 
| "Sweet Sweet Sweet" (Ending)
 
|-
 
| 8C
 
| $FB124
 
| 14
 
| Final Battle
 
|-
 
| 8D
 
| $FB3F7
 
| 0E
 
| Chemical Plant Zone
 
|-
 
| 8E
 
| $FB81E
 
| 13
 
| Boss
 
|-
 
| 8F
 
| $FBA6F
 
| 0D
 
| Sky Chase Zone
 
|-
 
| 90
 
| $FBD8C
 
| 04
 
| Oil Ocean Zone
 
|-
 
| 91
 
| $FC146
 
| 0F
 
| Wing Fortress Zone
 
|-
 
| 92
 
| $FC480
 
| 0C
 
| Emerald Hill Zone (2 Player)
 
|-
 
| 93
 
| $FC824
 
| 01
 
| 2 Player Results Screen
 
|-
 
| 94
 
| $FCBBC
 
| 16
 
| Super Sonic
 
|-
 
| 95
 
| $FCE74
 
| 06
 
| Hill Top Zone
 
|-
 
| 96
 
| $FD48D
 
| 18
 
| 1-Up
 
|-
 
| 97
 
| $FD193
 
| 19
 
| Title Screen
 
|-
 
| 98
 
| $FD35E
 
| 1A
 
| Stage Cleared
 
|-
 
| 99
 
| $FD57A
 
| 1B
 
| Game Over
 
|-
 
| 9A
 
| $F8359
 
| 17
 
| Invincibility
 
|-
 
| 9B
 
| $FD6C9
 
| 1D
 
| Got an Emerald
 
|-
 
| 9C
 
| $F803C
 
| 10
 
| Hidden Palace Zone
 
|-
 
| 9D
 
| $F823B
 
| 1F
 
| Underwater Timing
 
|-
 
| 9E
 
| $FD797
 
| 1E
 
| Credits
 
|}
 
 
 
* Pointer to Music Pointers at $F8000: $EC810
 
 
 
* Music Pointers (These add to F8000 and are for 98-9F, excluding continue): $F802A
 
** Specifics...
 
{|border="1"
 
! Pointer ID||Address||Sound Test ID||Song name
 
|-
 
| 01
 
| 0F0002
 
| 1C
 
| Continue
 
|}
 
* Sound Effect Pointers (These add to F8000): $FEE91
 
** Pointer to Sound Effect Pointers: $EC09C
 
 
 
===Sonic Crackers===
 
* Music Pointers: $0633F
 
** Specifics...
 
{|border="1"
 
|-
 
! Song||Sound ID||Location
 
|-
 
|Electoria||81||$10000
 
|-
 
|Walkin'||82||$1088C
 
|-
 
|Hyper-Hyper||83||$10BDA
 
|-
 
|Evening Star||84||$11210
 
|-
 
|Moonrise||85||$1172B
 
|-
 
|Game Over||86||$11B10
 
|}
 
 
 
===Sonic 3===
 
* Music Pointers (These add to $C8000): $E761A
 
* Music Pointers (These add to $D0000): $E762E
 
* Music Pointers (These add to $D8000): $E7652
 
* Music Pointers (These add to $C0000): $E7674
 
* Sound Effect Pointers (These add to $F8000): $E767E
 
 
 
===Sonic 3D===
 
* Music Pointers (These add to $C0000): $D3233
 
* Music Pointers (These add to $C8000): $D3245
 
* Music Pointers (These add to $D0000): $D325D
 
** Specifics...
 
{|border="1"
 
! Music ID||Music Pointer||Song name
 
|-
 
! colspan="3" | These add to $C0000:
 
|-
 
|01||2480||Green Grove 1
 
|-
 
|02||8F91||Green Grove 2
 
|-
 
|03||A0A8||Rusty Ruin 1
 
|-
 
|04||E7B9||Rusty Ruin 2
 
|-
 
|05||95C7||Volcano Valley 2
 
|-
 
|06||4AD0||Volcano Valley 1
 
|-
 
|07||39D7||Spring Stadium 1
 
|-
 
|08||72E3||Spring Stadium 2
 
|-
 
|09||91F0||Diamond Dust 1
 
|-
 
! colspan="3" | These add to $C8000:
 
|-
 
|0A||2480||Diamond Dust 2
 
|-
 
|0B||DE8B||Gene Gadget 1
 
|-
 
|0C||BD96||Gene Gadget 2
 
|-
 
|0D||A8A0||Panic Puppet 2
 
|-
 
|0E||E0A8||The Final Fight
 
|-
 
|0F||B396||Ending
 
|-
 
|10||55BB||Bonus Stage
 
|-
 
|11||8FC6||Panic Puppet 1/Level Select Screen
 
|-
 
|12||12D0||Boss Theme 1
 
|-
 
|13||20D6||Boss Theme 2
 
|-
 
|14||98DD||Intro
 
|-
 
|15||D9E1||Credits
 
|-
 
! colspan="3" | These add to $D0000:
 
|-
 
|16||2480||Game Over
 
|-
 
|17||7F82||Congratulations: You have found the secret Level Select screen" screen
 
|-
 
|18||9886||Bonus Stage End
 
|-
 
|19||158B||Extra Life
 
|-
 
|1A||658C||Chaos Emerald Gain
 
|-
 
|1B||558D||Invincibility
 
|-
 
|1C||2791||Main Menu
 
|}
 
 
 
* Sound Effect Pointers (These add to $D8000): $D3297
 
 
 
===Knuckles Chaotix===
 
* Music Pointers (These add to $40000): $76AE9
 
* Music Pointers (These add to $48000): $76B05
 
* Music Pointers (These add to $50000): $76B33
 
* Sound Effect Pointers (These add to $50000): $76B3B
 
 
 
===Sonic & Knuckles===
 
* Music Pointers: $F793E
 
{|border="1"
 
! Music ID||Music pointer||Song name
 
|-
 
! colspan="3" | These add to 2C8000:
 
|-
 
| 01
 
| 8000
 
| AIZ1
 
|-
 
| 02
 
| 9B6D
 
| AIZ2
 
|-
 
| 03
 
| B0BC
 
| HZ1
 
|-
 
| 04
 
| C0C6
 
| HZ2
 
|-
 
| 05
 
| D364
 
| MGZ1
 
|-
 
| 06
 
| D97B
 
| MGZ2
 
|-
 
| 07
 
| E48F
 
| CNZ1
 
|-
 
| 08
 
| DDA9
 
| CNZ2
 
|-
 
! colspan="3" | These add to E8000:
 
|-
 
| 09
 
| 8000
 
| FBZ1
 
|-
 
| 0A
 
| 8597
 
| FBZ2
 
|-
 
| 0F
 
| 8AFE
 
| MHZ1
 
* NOTE: This one is a bit tricky... The FE is right before the FF. Make sure to skip the FF or the driver will crash.
 
|-
 
| 10
 
| 9106
 
| MHZ2
 
|-
 
| 11
 
| 9688
 
| SZ1
 
|-
 
| 12
 
| 9CF2
 
| SZ2
 
|-
 
| 13
 
| A2E5
 
| LRZ1
 
|-
 
| 14
 
| ACF3
 
| LRZ2
 
|-
 
| 15
 
| BE80
 
| SSZ
 
|-
 
| 16
 
| C2B4
 
| DEZ1
 
|-
 
| 17
 
| C79F
 
| DEZ2
 
|-
 
| 18
 
| CBB1
 
| Act 1 Boss
 
|-
 
| 19
 
| CEE1
 
| Act 2 Boss
 
|-
 
| 1A
 
| D3DD
 
| Doomsday
 
|-
 
| 1B
 
| DCC0
 
| Rolling Jump Bonus Stage
 
|-
 
| 1C
 
| E223
 
| Special Stage
 
|-
 
| 1D
 
| EABB
 
| Slot Machine Bonus Stage
 
|-
 
| 1F
 
| F5A3
 
| Knuckles Theme
 
|-
 
| 25
 
| F88E
 
| Title
 
|-
 
| 2A
 
| FD4B
 
| 1UP
 
|-
 
| 2B
 
| FE75
 
| Chaos Emerald
 
|-
 
| 2E
 
| CBB1
 
| Act 1 Boss (same as 18)
 
|-
 
! colspan="3" | These add to 2D0000:
 
|-
 
| 0B
 
| 86AA
 
| IZ1
 
|-
 
| 0C
 
| 8000
 
| IZ2
 
|-
 
| 0D
 
| 9345
 
| LBZ1
 
|-
 
| 0E
 
| 8DC8
 
| LBZ2
 
|-
 
| 1E
 
| 8AE8
 
| Gum Ball Machine Bonus Stage
 
|-
 
| 20
 
| 99F7
 
| Azure Lake
 
|-
 
| 21
 
| A4FD
 
| Balloon Park
 
|-
 
| 22
 
| B0EC
 
| Desert Palace
 
|-
 
| 23
 
| C324
 
| Chrome Gadget
 
|-
 
| 24
 
| DA47
 
| Endless Mine
 
|-
 
| 26
 
| E587
 
| S3 credits
 
|-
 
| 2D
 
| F5E4
 
| Competition Menu
 
|-
 
| 31
 
| FABE
 
| S3 countdown
 
|-
 
! colspan="3" | These add to E0000:
 
|-
 
| 27
 
| DD4B
 
| Game/Time Over
 
|-
 
| 28
 
| DFA6
 
| Continue
 
|-
 
| 29
 
| E3C0
 
| Bonus Screen
 
|-
 
| 2C
 
| E574
 
| Invincible
 
|-
 
| 2F
 
| E7AF
 
| Menu
 
|-
 
| 30
 
| F74C
 
| Final Boss
 
|-
 
| 32
 
| FCDE
 
| S&K outro
 
|-
 
| DC
 
| C104
 
| S&K credits
 
|}
 
* Sound Effect Pointers (These add to $F8000): $F79AD
 
** Specifics...
 
{|border="1"
 
|-
 
! Sound Test ID||Pointer Value
 
|-
 
|$33||DE30
 
|-
 
|$34||DE5E
 
|-
 
|$35||DE6F
 
|-
 
|$36||DEA1
 
|-
 
|$37||DEC5
 
|-
 
|$38||DEF4
 
|-
 
|$39||DF2A
 
|-
 
|$3A||DF6B
 
|-
 
|$3B||DF96
 
|-
 
|$3C||DFE5
 
|-
 
|$3D||E023
 
|-
 
|$3E||E05D
 
|-
 
|$3F||E088
 
|-
 
|$40||E0AB
 
|-
 
|$41||E0CE
 
|-
 
|$42||E0F1
 
|-
 
|$43||E109
 
|-
 
|$44||E122
 
|-
 
|$45||E14F
 
|-
 
|$46||E177
 
|-
 
|$47||E1A4
 
|-
 
|$48||E1C4
 
|-
 
|$49||E1DE
 
|-
 
|$4A||E206
 
|-
 
|$4B||E22E
 
|-
 
|$4C||E278
 
|-
 
|$4D||E2A2
 
|-
 
|$4E||E2CF
 
|-
 
|$4F||E313
 
|-
 
|$50||E322
 
|-
 
|$51||E35A
 
|-
 
|$52||E38B
 
|-
 
|$53||E3A8
 
|-
 
|$54||E3E8
 
|-
 
|$55||E42B
 
|-
 
|$56||E453
 
|-
 
|$57||E463
 
|-
 
|$58||E481
 
|-
 
|$59||E49A
 
|-
 
|$5A||E4F6
 
|-
 
|$5B||E523
 
|-
 
|$5C||E530
 
|-
 
|$5D||E558
 
|-
 
|$5E||E581
 
|-
 
|$5F||E5B2
 
|-
 
|$60||E5DA
 
|-
 
|$61||E61B
 
|-
 
|$62||E64C
 
|-
 
|$63||E662
 
|-
 
|$64||E68C
 
|-
 
|$65||E6AB
 
|-
 
|$66||E6E1
 
|-
 
|$67||E730
 
|-
 
|$68||E75C
 
|-
 
|$69||E7B0
 
|-
 
|$6A||E7DD
 
|-
 
|$6B||E811
 
|-
 
|$6C||E823
 
|-
 
|$6D||E833
 
|-
 
|$6E||E852
 
|-
 
|$6F||E886
 
|-
 
|$70||E896
 
|-
 
|$71||E8E0
 
|-
 
|$72||E8EA
 
|-
 
|$73||E917
 
|-
 
|$74||E94B
 
|-
 
|$75||E978
 
|-
 
|$76||E9A7
 
|-
 
|$77||E9D1
 
|-
 
|$78||EA1B
 
|-
 
|$79||EA48
 
|-
 
|$7A||EA93
 
|-
 
|$7B||EAC7
 
|-
 
|$7C||EAF7
 
|-
 
|$7D||EB28
 
|-
 
|$7E||EB55
 
|-
 
|$7F||EB6D
 
|-
 
|$80||EB8B
 
|-
 
|$81||EBBA
 
|-
 
|$82||EC05
 
|-
 
|$83||EC32
 
|-
 
|$84||EC7E
 
|-
 
|$85||ECAB
 
|-
 
|$86||ECD8
 
|-
 
|$87||ED05
 
|-
 
|$88||ED3B
 
|-
 
|$89||ED68
 
|-
 
|$8A||ED75
 
|-
 
|$8B||EDA9
 
|-
 
|$8C||EDDF
 
|-
 
|$8D||EE10
 
|-
 
|$8E||EE2A
 
|-
 
|$8F||EE5B
 
|-
 
|$90||EE91
 
|-
 
|$91||EEC3
 
|-
 
|$92||EEF9
 
|-
 
|$93||EF2D
 
|-
 
|$94||EF77
 
|-
 
|$95||EFA6
 
|-
 
|$96||EFD5
 
|-
 
|$97||F009
 
|-
 
|$98||F01C
 
|-
 
|$99||F068
 
|-
 
|$9A||F090
 
|-
 
|$9B||F0AF
 
|-
 
|$9C||F114
 
|-
 
|$9D||F14B
 
|-
 
|$9E||F17F
 
|-
 
|$9F||F1C0
 
|-
 
|$A0||F1FC
 
|-
 
|$A1||F214
 
|-
 
|$A2||F23C
 
|-
 
|$A3||F274
 
|-
 
|$A4||F2A1
 
|-
 
|$A5||F2CE
 
|-
 
|$A6||F2FB
 
|-
 
|$A7||F313
 
|-
 
|$A8||F33B
 
|-
 
|$A9||F365
 
|-
 
|$AA||F38F
 
|-
 
|$AB||F3EA
 
|-
 
|$AC||F42A
 
|-
 
|$AD||F49C
 
|-
 
|$AE||F4AB
 
|-
 
|$AF||F4DA
 
|-
 
|$B0||F507
 
|-
 
|$B1||F582
 
|-
 
|$B2||F5D7
 
|-
 
|$B3||F603
 
|-
 
|$B4||F67D
 
|-
 
|$B5||F6AA
 
|-
 
|$B6||F6D2
 
|-
 
|$B7||F713
 
|-
 
|$B8||F745
 
|-
 
|$B9||F76C
 
|-
 
|$BA||F794
 
|-
 
|$BB||F7BE
 
|-
 
|$BC||F7CE
 
|-
 
|$BD||F7F9
 
|-
 
|$BE||F837
 
|-
 
|$BF||F86A
 
|-
 
|$C0||F89C
 
|-
 
|$C1||F8D1
 
|-
 
|$C2||F907
 
|-
 
|$C3||F91E
 
|-
 
|$C4||F94E
 
|-
 
|$C5||F97E
 
|-
 
|$C6||F9B7
 
|-
 
|$C7||F9F2
 
|-
 
|$C8||FA21
 
|-
 
|$C9||FA2B
 
|-
 
|$CA||FA66
 
|-
 
|$CB||FA9C
 
|-
 
|$CC||FAD7
 
|-
 
|$CD||FB12
 
|-
 
|$CE||FB45
 
|-
 
|$CF||FB60
 
|-
 
|$D0||FB6A
 
|-
 
|$D1||FBA1
 
|-
 
|$D2||FBBE
 
|-
 
|$D3||FBF4
 
|-
 
|$D4||FC2D
 
|-
 
|$D5||FC64
 
|-
 
|$D6||FC9D
 
|-
 
|$D7||FCCE
 
|-
 
|$D8||FCFF
 
|-
 
|$D9||FD32
 
|-
 
|$DA||FD62
 
|-
 
|$DB||FD94
 
|-
 
|$DC||FD94
 
|-
 
|$DD||FD94
 
|-
 
|$DE||FD94
 
|-
 
|$DF||FD94
 
|}
 
 
 
===Ristar===
 
 
 
* Music Pointers (32-bit): C852A
 
** Specifics...
 
{|border="1"
 
|-
 
! Address||Song
 
|-
 
|$CDBF4||Flora 1 [shooting ristar]
 
|-
 
|$CEA0E||Scorch 1 [busy flare]
 
|-
 
|$CF6B6||Flora 2 bgm [dancing leaves]
 
|-
 
|$D05F6||Pre boss [concentration]
 
|-
 
|$D0774||Sonata 1 (initial bgm) [intension]
 
|-
 
|$D0AC6||Sonata 1 (1st metronome)
 
|-
 
|$D0E7C||Sonata 1 (2nd metronome)
 
|-
 
|$D1218||Sonata 1 (final metronome)
 
|-
 
|$D1520||Sonata 2 [on parade]
 
|-
 
|$D1E88||Automaton 2 [lock up]
 
|-
 
|$D2C38||Freon 1 [ring rink]
 
|-
 
|$D36DC||Undertow 2 [break silence]
 
|-
 
|$D4346||Boss [crazy kings]
 
|-
 
|$D4DBE||Scorch 2 [under magma]
 
|-
 
|$D5A0A||Undertow 1 [splash down]
 
|-
 
|$D6752||Freon 2 [ice scream]
 
|-
 
|$D732C||Ending 2 [next cruise]
 
|-
 
|$D7E4E||Sonata 1 (mini boss) [du di du da]
 
|-
 
|$D81E8||Intro 1 [ebony force]
 
|-
 
|$D858C||Bonus [ready...GO!]
 
|-
 
|$D8D80||Intro 2/ Title [pray pray play!]
 
|-
 
|$D97EC||Bonus (preview) [formation lap]
 
|-
 
|$D997A||Continue Screen
 
|-
 
|$D9CFC||Greedy [theme of kaiser]
 
|-
 
|$DAA66||Automaton 1 [crying world]
 
|-
 
|$DAFB2||Ending 1 [star humming]
 
|-
 
|$DC422||Sonata 1 (initial bgm) [intension] *MID ROUND??*
 
|-
 
|$DC69A||round clear 2 [beyond space]
 
|-
 
|$DCF66||round clear 1 [lets go]
 
|-
 
|$DD240||area clear [go ahead]
 
|-
 
|$DD5C8||game over [game over .. fuu]
 
|-
 
|$DD7EC||defeated Greedy, before imploding cutscene
 
|-
 
|$DD978||Sonata 1 (mini boss 3 note intro)
 
|-
 
|$DDA1E||"Sega" music
 
|}
 
 
 
===MJ's Moonwalker===
 
* Music Pointers (32-bit): $600A4
 
 
 
===Gunstar Heroes===
 
* Music Pointers (32-bit): $68F42
 
** Specifics...
 
{|border="1"
 
|-
 
! Offset||ID||Song
 
|-
 
|$68F42||81||Pigmy Village, main
 
|-
 
|$68F46||82||complete a part of the dice palace
 
|-
 
|$68F4A||83||Pinky Roder
 
|-
 
|$68F4E||84||Orange
 
|-
 
|$68F52||85||Mine Cart Level
 
|-
 
|$68F56||86||Bravoo Man
 
|-
 
|$68F5A||87||(I thought it was the airship. may be "Destroy!" "Timeron," or various other bosses from the dice maze)
 
|-
 
|$68F5E||88||Seven Force
 
|-
 
|$68F62||89||Destroy Them All!
 
|-
 
|$68F66||8A||Dice Palace
 
|-
 
|$68F6A||8B||Title
 
|-
 
|$68F6E||8C||Sad Ending Cutscene
 
|-
 
|$68F72||8D||Space Ship Level
 
|-
 
|$68F76||8E||Stage Complete
 
|-
 
|$68F7A||8F||The Empire's holding yellow hostage
 
|-
 
|$68F7E||90||Black
 
|-
 
|$68F82||91||Final Run in the T.V.
 
|-
 
|$68F86||92||Disco-ball Vectorman Rip-off
 
|-
 
|$68F8A||93||Intro
 
|-
 
|$68F8E||94||Golden Silver
 
|-
 
|$68F92||95||Briefing, Level Select
 
|-
 
|$68F96||96||Credits
 
|-
 
|$68F9A||97||Game Over
 
|-
 
|$68F9E||98||Used in Various Mini-bosses, like "Super Gondola"
 
|-
 
|$68FA2||99||Continue?
 
|-
 
|$68FA6||9A||(not on sound test) Airship
 
|-
 
|$68FAA||9B||(not on sound test) Options
 
|}
 
 
 
 
 
===Dynamite Headdy===
 
* Music Pointers (32-bit): $5E536
 
 
 
===Alien Soldier===
 
* Music Pointers (32-bit): $84E78
 
 
 
===Phantasy Star 3===
 
* Music Pointers (These add to $6800): $70376
 
 
 
===Phantasy Star 4===
 
* Music Pointers (32-bit): $D1C40
 
 
 
===The Hybrid Front===
 
* Music Pointers (These add to $60000): $63AFA
 
* Sound Effect Pointers (These add to $68000): $63B2A
 
 
 
===Dyna Brothers 2===
 
* Music Pointers (These add to $1D0000): $1D01DF
 
 
 
===Revenge of Shinobi===
 
* Music Pointers (32-bit): $74770
 
* Sound Effect Pointers (32-bit): $747EC
 
 
 
===Dick Tracy===
 
* Music Pointers (These add to $78000): $78236
 
 
 
===Ghostbusters===
 
* Music Pointers (These add to $78000): $78268
 
 
 
===Castle of Illusion===
 
* Music Pointers (These add to $70000): $7008D
 
 
 
===Mystic Defender===
 
* Music Pointers (These add to $48000): $482AA
 
 
 
===ESWAT Cyber Police===
 
* Music Pointers (These add to $18000): $18326
 
 
 
===Dangerous Seed===
 
* Music Pointers (These add to $70000): $7823F
 
 
 
===Viewpoint===
 
* Music Pointers (These add to $10000): $10237
 
 
 
===Alien Storm===
 
* Music Pointers (These add to $78000): $78064
 
 
 
===Cosmic Carnage===
 
* Music Pointers (32-bit): $82AAC
 
** NOTE: Cosmic Carnage is 32x, so $900000 is added to each pointer.
 
 
 
===Columns III===
 
* Music Pointers (These add to $70000): $70255
 
 
 
===Stellar Assault (Shadow Squadron)===
 
* Music Pointers (32-bit): $C2868
 
** NOTE: Shadow Squadron is 32x, so $900000 is added to each pointer.
 
 
 
===Virtua Racing Deluxe (U)===
 
* Music Pointers (32-bit): $32AB7
 
** NOTE: "8B" at start of pointers resolves to $30000.
 
 
 
===Zaxxon's Motherbase 2000===
 
* Music Pointers (These add to $78000): $1F7E
 
* Music Pointers (These add to $70000): $1F9E
 
* Sound Effect Pointers (These add to $78000): $1FAE
 
 
 
==Tricks of the Trade==
 
===Music porting===
 
Ah, yes. Music porting. An infamous practice that many want to achieve. This section will explain the various methods of porting music from one game to another. If something is not possible, it will be noted.
 
 
 
====Sonic 1 -> Sonic 2 Beta====
 
This is one of the easier jobs in my opinion, but it can be a bit tough at first. The trick is to convert the pointer format from S1 to S2B format. First, you have to convert the header pointers. This is the easiest part, as all the pointers are simple relative pointers. So here's what you do...
 
 
 
First off, mark the location you want to place the music at in pointer form. EX: F8000 goes to 8000, which goes to 0080, etc etc. Then, take this base location and add the relative values to it. So if I was placing my music at F9CDE, and my voice pointer was 0312, I would add 312 bytes to F9CDE. This gives me F9FF0. I then take this and convert it into pointer form. An easy way to do so in this case is to simply remove the F. This leaves me with 9FF0, which I then byteswap. This leaves me with the final converted pointer of F09F. Do this for every pointer in the header, as the rest you can leave intact.
 
 
 
The next job is to convert all the pointers in the coordination flags that have them. There are 3 flags in total that do so: F6, F7, and F8. Become familiar with the syntax; Know which is the pointer and which is not. Converting proceeds as follows...
 
 
 
We'll start with an example of sorts. As I noted before, with coordination flag pointers in S1, signed values are used. FFFF is 0, etc. The math works in the same way as our last job, but this time we use different variables. Our base location is found out by marking the offset of the byte where the actual pointer is. In the case of F6 and F8, the byte after F6/F8. In the case of F7, skip two bytes after the F7 to where the pointer is. This is all in my syntax breakdowns, BTW.
 
 
 
Now that we have our base location, we can convert the pointer. Now remember, instead of 0000 being zero, in this case FFFF is zero. So if we want to convert our pointer easily, we have to make our pointer as simple as the header pointers. For negative jumps (below FFFF), we take the pointer value and subtract FFFF from it. This will leave us with a simple relative value. For example, if my S1 pointer was FFE6, I would subtract FFE6 from FFFF. This gives me 19 as a result, meaning this pointer is meant to locate data 19 bytes before our base location. Now we have to convert this into S2B form. Take your base location and subtract your result relative value (19 in my case) from it. For example, if my base location was FEE90 (90EE), I would subtract 19 bytes from it (my result value from the above operation). That would give me the offset of FEE77. I then convert this into pointer form, giving me the final converted pointer of 77EE.
 
 
 
For positive values (above FFFF), things are a bit simpler. Simply take the positive value and subtract 1 from it. Then, add it to your base location. So if my pointer was 0090, I subtract 1 from it. This gives me 8F. I then add this value to my base location, which was FEE90. FEE90 + 8F = FEF1F. Then, convert this into S2B pointer form. This gives me the final converted pointer of 1FEF. Fun, eh? =P
 
 
 
Remember to do this with ALL pointers in the song. You won't get off correcting two or three, I'll tell you that much. :P
 
 
 
====Points to note====
 
Always remember to change the music pointer to point to your new music. Otherwise you'll have done this all for nothing. Also, S1 voices are not entirely compatible with S2 voices. You may have to apply new voices to the song to make it sound right. This is why the instruments in Esrael's port of Marble zone sounded different; he had to make new ones.
 
 
 
====Porting between Sonic 3K/3D/Crackers/Chaotix====
 
This job is much simpler, as all pointers use the same format. There are two methods of porting this music between each other...
 
 
 
# Simply put the music in the "same" location according to pointer format. For example, having music at C0000 or C8000 would be the same as having it at 10000 or 18000. All the result pointers would be 0080. Get it? =P Simple copy and paste, and nothing else needs to be done. Just change the music pointer to point to the new music and presto! Ported music. This method limits your customization as where to put the music though, and I don't recommend it unless you are porting whole music banks or it is incredibly convenient. It is easier though, so hey. =P
 
# Modify all pointers inside the music (header and coordination flags) to go along with the new location you put it at. Here's a simple way to do so...
 
 
 
First off, take your original location, which is the beginning of the song. Then, work out where you are going to put the song. Convert both these values into pointer format. Now, work out the difference between these two values. For example, if the original location was F802A (2A80 in pointer format), and I wanted to put it at FD980 (80D9 in pointer format), then I would subtract my new location from my original location. So in my case, FD980 - F802A. This gives me 5956. Now, this will be your modifying value for each pointer. You add this location to each pointer in the song to get your converted pointer.
 
 
 
Let me give an example of a negative value. My original location was FA000 and my new location was F9027. This time, we switch the operation. FA000 - F9027 = FD9. This time, you subtract this value from each pointer in the song to get the converted pointer. So remember, if you are moving a song to a location before the original location, subtract. If you are moving it to a location beyond the original, add.
 
 
 
====Points to note====
 
If Sonic 3 music has D817 as the voice pointer, then it cannot be ported outside of S3K without being given a new voice set. Sonic 3K is the only game with this universal voice bank, and specifying it in any other game will have no effect.
 
 
 
====Porting from Sonic 2 Beta to Sonic 3K/3D/Crackers/Chaotix====
 
 
 
This is a very simple job, provided you have a good eye for detail. The trick is to replace the differing coordination flags between the two games. This is a simple task, and you can do it in two simple steps.
 
 
 
# Run a search in the song for coordination flag E3. This is the S2 flag to return. We need to replace this with the Sonic 3K/etc equivalent, F9. Change all valid instances of E3 to F9. This will fix awkward jumps in the song that were hindering porting before.
 
 
 
# Run another search in the song for coordination flag E9. This is the S2 flag to add a value to the current channel pitch. We need to replace this with the Sonic 3K equivalent, FB. Change all valid instances of E9 to FB. This will fix certain lagging in some songs, lack of pitch change, and even crashing.
 
 
 
When I mention valid instances, I mean that the values of E9 or E3 are not part of another coordination flag. Make sure you know the format of most coordination flags, as to avoid making fatal mistakes that may destroy your entire port.
 
 
 
====Points to note====
 
Some voices may be wrong. You will have to fix this manually, provided you know how.
 
 
 
 
 
====Porting from Sonic 3K/3D/Crackers/Chaotix to Sonic 2 Beta====
 
 
 
Just do the opposite of the method above; replace F9 with E3 and FB with E9.
 
  
 +
* August 23 2011: added missing s3/s&k Dac Sample $8E (Low Metal Hit)
 +
==References==
 +
<references />
  
 
{{SCHGuides}}
 
{{SCHGuides}}
[[Category:Sonic Community Hacking Guide]]
+
[[Category:Sonic Community Hacking Guide|Music Hacking]]

Latest revision as of 15:54, 24 March 2020

Music Hacking: Pointer and Header Format | Voice and Note Editing | DAC Samples, Coordination Flags, Game Specifics, and Real-Time Music Editing | Other Games and Data Locations | Tricks of the Trade



Original Credits

Guide originally created by Tweaker on May 25 2005.

Thanks to:

Prologue

You must have at least basic hex knowledge. If you have no idea what hex is, then I suggest you steer clear of this guide and figure things out first. It's also recommended that you read and save a copy of the YM2612 technical documentation and maybe the PSG documentation so that you can more easily understand how the voices and coordination flags work.

Update history

  • March 29 2005: Initial release.
  • April 22 2005: Updated Chaotix info. Also added explanation on Sonic 2 Final pointer format and corrected a few bits of incorrect info. Turns out you CAN use 6 FM channels and the DAC at the same time, thanks to the music engine. Can't say it works perfectly though. :P.
  • May 24 2005: Updated with even more Sonic 2 final info. Also added music pointer locations for Ristar and Michael Jackson's Moonwalker.
  • September ?? 2005: Fucking huge update. Massive amounts of new info, mainly concerning DAC samples. All the DAC sample definitions for Sonic 3 are now available, leaving many possibilities in the field. Also, I specified the DAC samples in Sonic 1 and 2 more, so Sonic QX users can be more precise with custom imports. Also, the purpose of two more coordination flags has been found out that have to do with PSG. Then, there are the small changes. A bit of proofreading, clarification... etc. I know I promised realtime music editing this update... Sorry I couldn't get it. It's my next priority, promise. =P

Some of these random things:

  1. Added some new locations. Found a new pointer set in Sonic 3 and found the sound effect pointers as well. Can't find out what the SFX add to yet though.
  2. Got into specifics with the Sonic 2 Final pointer list. And yes, it's in the right order. :P
  3. Added "$" signs to most ROM addresses as it's more proper. Meh, nitpicky shit. =P
  4. I wrote a tutorial on porting music from one game to another. I know people have been wanting this, so here you go. ;)


  • September 2 2006: Wow, it's been over a year since the last update! Has it really been that long? o_O

Anyway, I finally got the realtime music editing section done. Savestate locations and Z80 RAM equivalents are listed, with explanations on how to tinker with music, even while it’s still playing. Also added locations for a shitload of games, mostly from my notes. I also added more to the music porting section. And once again, various corrections and such... I can't be arsed to keep track of what I change anymore, so bleh. =P

  • August 22 2011: updated by kram1024, flamewing and others with all the new info discovered recently about smps by flamewing's most recent disasm of the s&k driver.
  • August 23 2011: added missing s3/s&k Dac Sample $8E (Low Metal Hit)

References


Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information