Jump to content

  •  

  • Photo

    Some Sonic 2 Sound/Music Questions


    • This topic is locked This topic is locked
    18 replies to this topic

    #1 Shadow Fire

    Shadow Fire

      The Chosen One

    • Administrator
    • 277 posts
    • Gender:Male
    • Location:Space.
    • Interests:Stuff. =P

    Posted 09 April 2012 - 02:48 PM

    Okay, first of all, I would like to explain that I am planning on getting back into hacking Sonic: The Lost Land 2, as well as the original Sonic: The Lost Land. Since I'm working with ASM, it's safe to assume that I've had to do most of the edits I've already made to STLL2, from scratch. Much of it has been restored, and it's looking okay, but I'm having a few questions creeping up on me.

    Firstly, I wanna change the SEGA sound. I have a file that I want to use, but there seems to be no documentation around that explains how to make this happen.

    Secondly, I have music I wish to recover. In the original STLL2, Wing Fortress' level music was replaced by Flying Battery 1's. I can't seem to locate the updated pointer to the music files, and this leaves me a bit confused as to how to bring it back. I'd simply have taken it from S3K using Esrael's tool, but again, Sonic 2 receives no love.
    • 0

    #2 Tongara

    Tongara

      5 Chaos Emeralds

    • Exile
    • 360 posts
    • Gender:Male
    • Location:Birmingham, UK
    • Interests:Having Sex and making people cry.

    Posted 09 April 2012 - 06:02 PM

    Firstly, I wanna change the SEGA sound. I have a file that I want to use, but there seems to be no documentation around that explains how to make this happen.

    That one is super easy. You can overwrite the segapcm sound file itself with a wav that is 8-bit pcm (not sure if it's stereo or mono). You can download sndrec32.exe to do this!
    When overwriting the segapcm file, make sure that you're saving it as a .bin file.

    Secondly, I have music I wish to recover. In the original STLL2, Wing Fortress' level music was replaced by Flying Battery 1's. I can't seem to locate the updated pointer to the music files, and this leaves me a bit confused as to how to bring it back. I'd simply have taken it from S3K using Esrael's tool, but again, Sonic 2 receives no love.

    Try splitting your original version of the hack with a new disassembly, and see if you can recover the wing fortress .bin music file and replace it with the one in the new version of your hacks disassembly.

    Edited by Tongara, 09 April 2012 - 06:04 PM.

    • 0

    #3 Shadow Fire

    Shadow Fire

      The Chosen One

    • Administrator
    • 277 posts
    • Gender:Male
    • Location:Space.
    • Interests:Stuff. =P

    Posted 09 April 2012 - 07:40 PM


    Firstly, I wanna change the SEGA sound. I have a file that I want to use, but there seems to be no documentation around that explains how to make this happen.

    That one is super easy. You can overwrite the segapcm sound file itself with a wav that is 8-bit pcm (not sure if it's stereo or mono). You can download sndrec32.exe to do this!
    When overwriting the segapcm file, make sure that you're saving it as a .bin file.

    Secondly, I have music I wish to recover. In the original STLL2, Wing Fortress' level music was replaced by Flying Battery 1's. I can't seem to locate the updated pointer to the music files, and this leaves me a bit confused as to how to bring it back. I'd simply have taken it from S3K using Esrael's tool, but again, Sonic 2 receives no love.

    Try splitting your original version of the hack with a new disassembly, and see if you can recover the wing fortress .bin music file and replace it with the one in the new version of your hacks disassembly.

    First one sorted, thanks Tongara. For the record, it is 8-bit PCM, 16,000 KHz, Mono that is needed. Figured that out through trial and error.

    As for the FBZ music, I already tried that, but because the locations were altered, and I have no idea where to even begin looking (it seems the location for the pointers has changed also), I can't seem to grab it.
    • 0

    #4 redhotsonic

    redhotsonic

      Also known as RHS

    • Staff
    • 2066 posts
    • Gender:Male
    • Location:United Kingdom

    Posted 09 April 2012 - 08:06 PM



    Firstly, I wanna change the SEGA sound. I have a file that I want to use, but there seems to be no documentation around that explains how to make this happen.

    That one is super easy. You can overwrite the segapcm sound file itself with a wav that is 8-bit pcm (not sure if it's stereo or mono). You can download sndrec32.exe to do this!
    When overwriting the segapcm file, make sure that you're saving it as a .bin file.

    First one sorted, thanks Tongara. For the record, it is 8-bit PCM, 16,000 KHz, Mono that is needed. Figured that out through trial and error.


    I downloaded this application and it's in a different language so it's hard to get the hang of. But it seems it only saves as a WAV file. How do you convert it to .bin as I'm guessing it's not as simple as changing the extension from WAV to BIN?
    • 0

    #5 Tongara

    Tongara

      5 Chaos Emeralds

    • Exile
    • 360 posts
    • Gender:Male
    • Location:Birmingham, UK
    • Interests:Having Sex and making people cry.

    Posted 09 April 2012 - 09:17 PM



    Firstly, I wanna change the SEGA sound. I have a file that I want to use, but there seems to be no documentation around that explains how to make this happen.

    That one is super easy. You can overwrite the segapcm sound file itself with a wav that is 8-bit pcm (not sure if it's stereo or mono). You can download sndrec32.exe to do this!
    When overwriting the segapcm file, make sure that you're saving it as a .bin file.

    First one sorted, thanks Tongara. For the record, it is 8-bit PCM, 16,000 KHz, Mono that is needed. Figured that out through trial and error.


    I downloaded this application and it's in a different language so it's hard to get the hang of. But it seems it only saves as a WAV file. How do you convert it to .bin as I'm guessing it's not as simple as changing the extension from WAV to BIN?

    Generally where you select file type in any application, select all files and name it segapcm.bin or whatever the sega sound file is called. OR do what you said. :P
    • 0

    #6 ValleyBell

    ValleyBell

      2 Chaos Emeralds

    • Pro User
    • 77 posts
    • Gender:Male

    Posted 09 April 2012 - 09:22 PM

    Don't make it more complicated than it needs to be - use Audacity.

    To open the SEGA sound, open the File menu and use Import -> Raw Data. The codec is "Unsigned 8-bit PCM".
    To save it, chose File -> Export. Then select the file type "Other uncompressed files", click the Options button and chose "RAW (header-less)" as header type and "Unsigned 8-bit PCM" as codec.
    Then save (ignore the metadata editor, it does nothing in this case) and you're done.


    If you already have a wav-file in the correct format, open it in the hex-editor of your choice and search for "data". Then delete all bytes from offset 0 to the data-text + the 4 bytes after the data-text. (usually 2Ch bytes or 38h bytes if there is a "fact" block between the "fmt" and "data" ones) Done.


    A last note: The size of the SEGA sound is hardcoded into the ROM, so you either need to find and fix this value or your new sound must have the exactly same size as the old one.
    • 0

    #7 Tongara

    Tongara

      5 Chaos Emeralds

    • Exile
    • 360 posts
    • Gender:Male
    • Location:Birmingham, UK
    • Interests:Having Sex and making people cry.

    Posted 09 April 2012 - 09:26 PM

    Don't make it more complicated than it needs to be - use Audacity.

    To open the SEGA sound, open the File menu and use Import -> Raw Data. The codec is "Unsigned 8-bit PCM".
    To save it, chose File -> Export. Then select the file type "Other uncompressed files", click the Options button and chose "RAW (header-less)" as header type and "Unsigned 8-bit PCM" as codec.
    Then save (ignore the metadata editor, it does nothing in this case) and you're done.


    If you already have a wav-file in the correct format, open it in the hex-editor of your choice and search for "data". Then delete all bytes from offset 0 to the data-text + the 4 bytes after the data-text. (usually 2Ch bytes or 38h bytes if there is a "fact" block between the "fmt" and "data" ones) Done.


    A last note: The size of the SEGA sound is hardcoded into the ROM, so you either need to find and fix this value or your new sound must have the exactly same size as the old one.

    Yes, because rather than just saving over a file, importing it as raw data, then editing it in a hex editor is so much easier.... right?

    I'm sorry, but are you on drugs? o_O

    Edited by Tongara, 09 April 2012 - 09:28 PM.

    • 0

    #8 redhotsonic

    redhotsonic

      Also known as RHS

    • Staff
    • 2066 posts
    • Gender:Male
    • Location:United Kingdom

    Posted 09 April 2012 - 09:28 PM

    Generally where you select file type in any application, select all files and name it segapcm.bin or whatever the sega sound file is called. OR do what you said. :P


    I didn't know it was as simple as naming from WAV to BIN, cheers =P



    A last note: The size of the SEGA sound is hardcoded into the ROM, so you either need to find and fix this value or your new sound must have the exactly same size as the old one.


    That's a bummer. Anyway, I won't be changing the SEGA sound, just be adding some more PCM's. But is there a size limit for putting in PCMs?
    • 0

    #9 Tongara

    Tongara

      5 Chaos Emeralds

    • Exile
    • 360 posts
    • Gender:Male
    • Location:Birmingham, UK
    • Interests:Having Sex and making people cry.

    Posted 09 April 2012 - 09:30 PM

    Generally where you select file type in any application, select all files and name it segapcm.bin or whatever the sega sound file is called. OR do what you said. :P


    I didn't know it was as simple as naming from WAV to BIN, cheers =P

    As long as it's exported with the right settings, you're good to go!
    As Shadow Fire said: " 8-bit PCM, 16,000 KHz, Mono".
    • 0

    #10 MarkeyJester

    MarkeyJester

      Driving The Last Spike

    • Pro User
    • 1846 posts
    • Gender:Male

    Posted 09 April 2012 - 09:38 PM

    Generally what I do is:

    Sound:        incbin    "Sound.wav", $3A
    
    Sound_End:    even

    WAV files that are 8-bit unsigned mono have a header size of 3A, by placing 3A at the end of the include of the WAV file, I have included the RAW PCM data without the header into the ROM, and I can easily open the sample with a sound/media player to see what it sounds like. This eliminates the need to extract it to RAW.
    • 0

    #11 ValleyBell

    ValleyBell

      2 Chaos Emeralds

    • Pro User
    • 77 posts
    • Gender:Male

    Posted 09 April 2012 - 09:57 PM

    But is there a size limit for putting in PCMs?

    If the PCM sound is played by the 68000 (e.g. S2 Clone Driver), the limit should be the size of the ROM.
    If it's played by the Z80 (plain Sonic 1/2/3), the limit is usually the size of a Z80 bank, i.e. 8000h bytes.
    • 0

    #12 Spanner

    Spanner

      Tool

    • Staff
    • 1798 posts
    • Gender:Male
    • Location:United Kingdom

    Posted 09 April 2012 - 11:11 PM

    Shadow Fire, surely you could use the Clone Driver and port FBZ again, if you want the file grab it from flamewing's pack.
    • 0

    #13 Tongara

    Tongara

      5 Chaos Emeralds

    • Exile
    • 360 posts
    • Gender:Male
    • Location:Birmingham, UK
    • Interests:Having Sex and making people cry.

    Posted 10 April 2012 - 04:08 AM

    Generally what I do is:

    Sound:		incbin	"Sound.wav", $3A
    
    Sound_End:	even

    WAV files that are 8-bit unsigned mono have a header size of 3A, by placing 3A at the end of the include of the WAV file, I have included the RAW PCM data without the header into the ROM, and I can easily open the sample with a sound/media player to see what it sounds like. This eliminates the need to extract it to RAW.

    I wasn't aware that you could just include the .wav files. That is quite amazing!
    The thing is, it doesn't ever really seem to need the header... it just seems to work.
    • 0

    #14 Shadow Fire

    Shadow Fire

      The Chosen One

    • Administrator
    • 277 posts
    • Gender:Male
    • Location:Space.
    • Interests:Stuff. =P

    Posted 10 April 2012 - 06:38 AM

    Shadow Fire, surely you could use the Clone Driver and port FBZ again, if you want the file grab it from flamewing's pack.

    I managed to (after a lot of hassle) port the clone driver, something I neglected, simply because I forgot to. =P However, this presents me with another problem. As you may or may not know, I have water loaded in MCZ, which I drew from HPZ, modifying its palette to fit with MCZ's already modded palette. The use of the clone driver has changed the underwater palette used, and I cannot for the life of me figure out how to change it to load from my altered palette.
    • 0

    #15 MarkeyJester

    MarkeyJester

      Driving The Last Spike

    • Pro User
    • 1846 posts
    • Gender:Male

    Posted 10 April 2012 - 01:25 PM

    The problem is that the "Clone Driver" is Sonic 1's SMPS script player, and the address of where the sound driver stores its information is at FFF000+. Now, when Sonic Team changed their sound driver to use Z80 when working on Sonic 2, they decided to move the underwater palettes to where the sound driver space used to be:

    Underwater_palette_2 =		 ramaddr( $FFFFF000 ) ; not sure what it's used for but it's only used when there's water
    
    Underwater_palette =		 ramaddr( $FFFFF080 ) ; main palette for underwater parts of the screen
    
    Underwater_palette_line4 =	 ramaddr( $FFFFF0E0 )

    What you will need to do, is change that address to somewhere else, somewhere where there's 100 bytes free to use, Sonic 1 had it's underwater palettes stored at around FFFA00 - FFFAFF if I recall correctly, and from the looks of things, Sonic 2 doesn't use that space (even though they moved the palette), so you "might" get away with moving the underwater palette back to it's original Sonic 1 address:

    Underwater_palette_2 =		 ramaddr( $FFFFFA00 ) ; not sure what it's used for but it's only used when there's water
    
    Underwater_palette =		 ramaddr( $FFFFFA80 ) ; main palette for underwater parts of the screen
    
    Underwater_palette_line4 =	 ramaddr( $FFFFFAE0 )

    Although I know my way around the Mega Drive, I'm no expert on Sonic 2 specifically, so forgive me if this doesn't resolve your problem.
    • 0

    #16 redhotsonic

    redhotsonic

      Also known as RHS

    • Staff
    • 2066 posts
    • Gender:Male
    • Location:United Kingdom

    Posted 10 April 2012 - 06:14 PM

    Funny, mine is:

    Underwater_palette_2 = 		ramaddr( $FFFFF000 ) ; not sure what it's used for but it's only used when there's water
    
    Underwater_palette = 		ramaddr( $FFFFFA80 ) ; main palette for underwater parts of the screen
    
    Underwater_palette_line4 = 	ramaddr( $FFFFF0E0 )

    And the underwater palette is still fine, and I have the S2Clonedriver. Although I will say ValleyBell has heavily modified mine or has changed it completely. The only problem I get (which is rare) is when lots of objects are underwater, the underwater palette fucks up (sprite-table spills over onto the palette).




    Generally what I do is:

    Sound:		incbin	"Sound.wav", $3A
    
    Sound_End:	even

    WAV files that are 8-bit unsigned mono have a header size of 3A, by placing 3A at the end of the include of the WAV file, I have included the RAW PCM data without the header into the ROM, and I can easily open the sample with a sound/media player to see what it sounds like. This eliminates the need to extract it to RAW.



    The sound end is a little bit wierd. If I was to do more than 1 WAV, can I try this?


    SoundA:		incbin	"Sound.wav", $3A
    
    SoundB:		incbin	"Sound2.wav", $3A
    
    MusicA:		incbin	"Music.wav", $3A
    
    Sound_End:	even

    or


    SoundA:		incbin	"Sound.wav", $3A
    
        even
    
    SoundB:		incbin	"Sound2.wav", $3A
    
        even
    
    MusicA:		incbin	"Music.wav", $3A
    
        even




    But is there a size limit for putting in PCMs?

    If the PCM sound is played by the 68000 (e.g. S2 Clone Driver), the limit should be the size of the ROM.
    If it's played by the Z80 (plain Sonic 1/2/3), the limit is usually the size of a Z80 bank, i.e. 8000h bytes.


    The size for the 68k sounds way too much, and the Z80 size sounds way too small =P
    • 0

    #17 Shadow Fire

    Shadow Fire

      The Chosen One

    • Administrator
    • 277 posts
    • Gender:Male
    • Location:Space.
    • Interests:Stuff. =P

    Posted 10 April 2012 - 06:38 PM

    The problem is that the "Clone Driver" is Sonic 1's SMPS script player, and the address of where the sound driver stores its information is at FFF000+. Now, when Sonic Team changed their sound driver to use Z80 when working on Sonic 2, they decided to move the underwater palettes to where the sound driver space used to be:

    Underwater_palette_2 =		 ramaddr( $FFFFF000 ) ; not sure what it's used for but it's only used when there's water
    
    Underwater_palette =		 ramaddr( $FFFFF080 ) ; main palette for underwater parts of the screen
    
    Underwater_palette_line4 =	 ramaddr( $FFFFF0E0 )

    What you will need to do, is change that address to somewhere else, somewhere where there's 100 bytes free to use, Sonic 1 had it's underwater palettes stored at around FFFA00 - FFFAFF if I recall correctly, and from the looks of things, Sonic 2 doesn't use that space (even though they moved the palette), so you "might" get away with moving the underwater palette back to it's original Sonic 1 address:

    Underwater_palette_2 =		 ramaddr( $FFFFFA00 ) ; not sure what it's used for but it's only used when there's water
    
    Underwater_palette =		 ramaddr( $FFFFFA80 ) ; main palette for underwater parts of the screen
    
    Underwater_palette_line4 =	 ramaddr( $FFFFFAE0 )

    Although I know my way around the Mega Drive, I'm no expert on Sonic 2 specifically, so forgive me if this doesn't resolve your problem.

    I'm afraid that it hasn't resolved the problem...

    I'd like to point out that ARZ and CPZ's underwater palettes are fine, but MCZ isn't. Here is what the palette currently looks like:

    Attached File  STLL2_031.gif   17.19KB   15 downloads

    It is meant to look like this:

    Attached File  STLL2_009.gif   11.65KB   13 downloads

    It was working fine up until I ported the clone driver. When I look at the palette area for the water, it seems to be correct.

    Level_LoadPal:
    
    	moveq	#3,d0
    
    	bsr.w	PalLoad2	; load Sonic's palette line
    
    	tst.b	(Water_flag).w	; does level have water?
    
    	beq.s	Level_GetBgm	; if not, branch
    
    	moveq	#$15,d0	; palette number $15
    
    	cmpi.b	#$B,(Current_Zone).w
    
    	beq.s	Level_WaterPal ; branch if level is HPZ (modified for MCZ)
    
    	moveq	#$16,d0	; palette number $16
    
    	cmpi.b	#$D,(Current_Zone).w
    
    	beq.s	Level_WaterPal ; branch if level is CPZ
    
    	moveq	#$17,d0	; palette number $17

    • 0

    #18 DrHackMan

    DrHackMan

      I don't always herp, but when I herp, I derp

    • Member
    • 33 posts
    • Gender:Male
    • Location:Eggmanland

    Posted 10 April 2012 - 06:49 PM

    Try to comment the driver out part for part. If it works again you know what interferes with the palette.

    Edited by DrHackMan, 10 April 2012 - 07:44 PM.

    • 0




    0 user(s) are reading this topic

    0 members, 0 guests, 0 anonymous users