Sonic and Sega Retro Message Board: Porting Music to Sonic 1; What causes the Sega sound? - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Porting Music to Sonic 1; What causes the Sega sound? Bad bytes in DAC set it off, but which ones?

#1 User is offline WatuD2 

Posted 23 January 2017 - 05:13 PM

  • Posts: 3
  • Joined: 22-January 17
  • Gender:Male
  • Location:Middlesex County, New Jersey, United States
Hello all,
I'm currently doing some research into Sonic 1's sound driver.; you know, porting songs between other SMPS 68K games, using Esrael's Sound Importer, etc. One problem I've ran into consistently is that certain bad bytes within the DAC section of the hexadecimal codes set off the Sega sound. Now, I have two questions about this.

1.) How does anything related to drums have the ability to set off a PCM sample? (The Sega Sound)

2.) I know that the byte "0C" sets it off, but there are others and I can't pinpoint them. Does anyone have any input on this situation?

I've looked around and wasn't able to find any topics or posts relating to this manner, though if anyone knows of some giant thread all about this, link it up and I'll do my best to scavenge for an answer.

EDIT: By Byte "0C", I'm referring to the music binaries that come with the disassembly.
This post has been edited by WatuD2: 23 January 2017 - 05:39 PM

#2 User is offline MarkeyJester 

Posted 23 January 2017 - 05:32 PM

  • Full of surprises, pull the ribbons for details~
  • Posts: 1759
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
The drum samples to Sonic 1 are stored as 4-bit DPCM samples and are stored inside the Z80 driver itself. The SEGA sample on the other hand is stored in the ROM, uncompressed as an 8-bit unsigned PCM sample, the Z80 driver sets the bank switch of the upper 8000 bytes (8000 - FFFF) to point to the 68k address of the SEGA sample, this is done right at the beginning as the driver is started. This allows the driver to just read data from the window, and immediately know it's the SEGA sample.

Now, the DPCM samples have a table of Z80 pointers, pointing to the DPCM samples in Z80 RAM. This table only has three entries, accessing any entries outside of the three will access words from the DPCM samples themselves, of which are not pointers, but are being treated as such. Majority of the words being read just happen to either point to 8000+ (where the window is), or the size is larger enough for the Z80 to spill over into the 8000+ region. Which is why the SEGA sample just happens to play.

As for 2. you're gonna have to be more specific by what you mean when you say 'byte "0C"'. Byte 0C of what? The SMPS DAC tracker value, a byte/offset in the Z80 driver?

EDIT: To brief aside about Sonic 1's samples that are available:

81 = Kick
82 = Snare
83 = Timpani (Just a placeholder of the table)
84 = Invalid
85 = Invalid
86 = SEGA Sample
87 = Invalid
88 = Timpani (high)
89 = Timpani (Mid)
8A = Timpani (Low)
8B = Timpani (Lower)
8C+ = Invalid

So I assume by 0C you mean sample ID 0C. In which case, yeah, that's why. It's an invalid entry in the table.
This post has been edited by MarkeyJester: 23 January 2017 - 05:38 PM

#3 User is offline WatuD2 

Posted 23 January 2017 - 05:40 PM

  • Posts: 3
  • Joined: 22-January 17
  • Gender:Male
  • Location:Middlesex County, New Jersey, United States
Thanks for your reply!

I'm sorry, should've elaborated more. By Byte "0C", I was referencing to the sample ID 0C. So, if there's any Sample ID that isn't between 81 & 8B, it loads in garbage that may just happen to be the Sega sound?
This post has been edited by WatuD2: 23 January 2017 - 05:46 PM

#4 User is offline MarkeyJester 

Posted 23 January 2017 - 05:47 PM

  • Full of surprises, pull the ribbons for details~
  • Posts: 1759
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
Alright.

Well, the trouble is, Sonic 1 only has three samples, of which one of them (the timpani) is playable through four different pitches. Sonic 2 has more samples, I believe there are toms, scratches, and so forth, and those do not exist in Sonic 1. You're options are either, to modify the drum tracker channel so that is uses whatever samples Sonic 1 has, and improvise. Or, you'll have to port over the drum samples themselves and setup the table accordingly, this isn't going to be an easy task though, since Sonic 1's samples are stored in the Z80 itself, it's almost nearly impossible to fit more samples in. Unless you removed the SEGA sample, and put your samples where the SEGA sample is, and read it that way, but I'm degressing a stupid option here. Your alternative solution would be to change the Z80 driver such that it uses a "different" PCM/DPCM playback driver, one with more flexibility.

I would strongly recommend Mega PCM by vladikcomper http://forums.sonicr...showtopic=29057 This would be best suited to your needs. There's also Dual PCM https://forums.sonic...showtopic=36223

However, some of it is a little technical. It depends on how far up to the challenge you are at ripping out and putting in new drivers, just to port music between games flawlessly.

EDIT: There may also be a port for Sonic 3 & Knuckles' sound driver, but, I've not been interested enough to know the details, maybe someone else could help you out there...
This post has been edited by MarkeyJester: 23 January 2017 - 05:49 PM

#5 User is offline WatuD2 

Posted 23 January 2017 - 06:04 PM

  • Posts: 3
  • Joined: 22-January 17
  • Gender:Male
  • Location:Middlesex County, New Jersey, United States

Quote

Well, the trouble is, Sonic 1 only has three samples, of which one of them (the timpani) is playable through four different pitches. Sonic 2 has more samples, I believe there are toms, scratches, and so forth, and those do not exist in Sonic 1.


That would explain why porting the music from Mystic Cave 2P gives me no drums (except for an occasional kick, though I'm certain that's just a happy accident).

So, just to make sure that I'm understanding this correctly, changing drivers will allow PCMs to take less space on the Z80 / store them somewhere else all together so that more samples can fit essentially support all of the sounds that are "missing" from Sonic 2?

#6 User is offline MarkeyJester 

Posted 24 January 2017 - 07:42 AM

  • Full of surprises, pull the ribbons for details~
  • Posts: 1759
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
More or less, yes.

The drivers I linked above work in a different principle. The most noteable one, is that the samples will be stored on the ROM itself, and the Z80 will access those through the bank window, this will allow you to have larger samples, and more of them.

#7 User is offline Natsumi 

Posted 24 January 2017 - 08:38 AM

  • Miss Fox
  • Posts: 145
  • Joined: 08-February 12
  • Gender:Female
  • Location:Otter's lap
  • Project:Being with my boyfriend
I want to give a recommendation to you; Do not use any pre-made importer tools to port music. Although they *will* work to some degree, it usually, if not always, leads to sloppy ports that do not sound good. And as a community we have evolved past this point, and I would suggest if you are up for the challenge, follow suit. I have made a toolkit to allow for easier porting between theoretically any two SMPS games. Now, porting between two games is not as easy task as it may seem. The trouble is, is that SMPS is kind of a shitty format. You see, there is no standardization, and this is why you need to ensure the SMPS files are compatible before you plop them from one game to another. This task is made easier with my version of SMPS2ASM, but you need to spend some time to prepare scripts, and then to manually edit out any missing DAC, PSG, and commands.

The bottom line is, that it is gonna require way more effort, but as an end result you can get conversions that sounds miles better, and will have very minimal issues (So, nothing like that SEGA sound mess you have to deal with now :V). Of course, I can also offer some help if you get lost or confused, the best way you can reach me is SSRG IRC or Discord.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users