|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
Sega/BO/SMPS “SOUND-SORCE” music engine: documentation and tools
Posted: Sat Oct 07, 2023 12:55 pm
|
It’s well known that many Sega games have almost identical music engines, with a characteristic RAM based trigger using values from $80 to start new songs. This engine seems to have a heritage dating back to the earliest Master System/Mark III games, as well as arcade games, but undoubtedly had some variations and evolution across time.
I think sometimes it has been referred to as “pre-SMPS”, where SMPS is as per https://segaretro.org/SMPS . Elsewhere I think I saw references to it being written by Tokuhiko Uwabo, at least at first. See https://hiddenpalace.org/News/Sega_of_Japan_Sound_Documents_and_Source_Code for example. Recently I’ve been looking at the (dual-chip FM and PSG) version in Phantasy Star. I’ve also looked at the disassembly of the Snail Maze BIOS at https://github.com/maxim-zhao/smsbioses/blob/master/1.3/Bios13.asm which seems to be extremely similar, as is the (incomplete) description of SMPS linked above. I aim to write up some documentation on the wiki to cover what I find. Are there existing projects covering this that I might make use of? It seems like it might be useful or even desirable for people to make use of the engine, but is there a way to make it easy to arrange music for it? Maybe the Mega Drive scene has done something already? The engine seems to be common, but not always identical, and the data seems to be mixed into the code in a way that makes it hard to write a tool to extract song/SFX data from ROMs. |
|
|
Posted: Sat Oct 07, 2023 6:31 pm |
A few people (including ValleyBell and myself) made converters which target the SMPS driver used in the 16-bit Sonic games, yes. My one converts from XM, his one from MIDI. Also, mine is a terrible piece of software by any standard, in retrospect I'm ashamed of how I coded it, I would completely overhaul it nowadays.
Aside from the converter, ValleyBell made extensive research and disassemblies of various SMPS drivers, though I'm not sure if this link is publicly viewable: https://forums.sonicretro.org/index.php?threads/valley-bells-smps-research.32473/ I might have been a precursor when it came to Sonic music hacking, but ValleyBell is definitely THE go-to person when it comes to SMPS, now and forever. He helped me in the blink of an eye when I asked him a second opinion about the music in Rainbow Islands, I wouldn't have succeeded without him. |
|
|
Posted: Sun Oct 08, 2023 10:44 am |
Not sure if this is of any use for your research - it might be going in the wrong direction, chronologically - but there's also the annotated disassembly of the SMPS driver from Sonic 2.
Plus the data structure & format notes page, which was also enhanced by ValleyBell: https://info.sonicretro.org/SCHG:Sonic_the_Hedgehog_2_(Master_System)/Music_Hack... |
|
|
Posted: Sun Oct 08, 2023 11:20 am |
Right, I didn't mention it, because I ignorantly assumed that ValleyBell superseded it in his gigantic pack, but I didn't mean to be disrespectful. I apologise if that was the case. My comment from back then still stands. Interestingly enough, it was October 8th even at that time, so happy anniversary, I guess 😁 | |
|
Posted: Sun Oct 08, 2023 12:25 pm |
That thought didn't even enter my head. I didn't meant to imply anything and no offence was taken. I rememer most of ValleyBell's pack being MegaDrive stuff so I thought this might have been useful, for an additional SMS perspective.
Oh, wow. 14 years ago!? That's depressing :) |
|
|
Posted: Sun Oct 08, 2023 1:07 pm |
Thanks, this is all super helpful. Valleybell’s pack seems to be Mega Drive oriented, but I suspect Phantasy Star will be somewhere between the BIOS engine (which is PSG only and relatively basic) and Sonic 2 (which is quite a few years later, but still PSG only). Doing a dual-chip engine might be fun and maybe a way to make some retconned FM soundtracks later? | |
|
Posted: Mon Oct 16, 2023 8:04 am |
I disassembled and labelled a number of Master System SMPS drivers.
They are in SMPS_Research_Pack_v5_DriverDisasm.7z, in the folder Drivers/SMPS_Z80/SMS. They include:
I didn't do a lot of research on the SMS variant, but there is limited support for the "later" sound driver variant used by e.g. by Sonic 2/Chaos/Triple Trouble that has a song header similar to MegaDrive SMPS. SMPSPlay v2 can play such Master System SMPS songs - if you provide correct format specification files. (I have some for Sonic 2 and STT.) SMPSExtract may be able to extract songs, but it currently assumes MegaDrive Z80 banking. (pointers in the range $8000 .. $FFFF) I remember Phantasy Star's PSG/FM driver being interesting, because songs generally share the same note data for FM and PSG versions and just have different headers. The "set instrument" command has 2 parameters - one for a PSG instrument and another one for the FM instrument. The main difference for "pre-SMPS" vs. (later) "SMPS" is the song header:
btw: The origins of the sound driver can be traced back to Arcade games like Space Harrier and OutRun. Those games use the same system for frequency and volume envelopes. I think looping worked similar as well? The pre-SMPS driver used in the Snail Maze SMS BIOS driver resembles the Arcade drivers more closely than later variants, as it supports pitch slides between two specific notes (with frequency interpolation!). That feature was later cut. (It was CPU-heavy anyway.) I think the sound driver made a transition this way:
MegaDrive SMPS 68k is a different branch (originated from 16-bit pre-SMPS Z80) with its own story. |
|
|
Posted: Mon Oct 16, 2023 5:00 pm |
Well, maybe I wasted a few hours annotating the PS disassembly then :) indeed it does share channel data between PSG and FM, but sometimes has extra channels for FM or (more often) prepends an extra wait to make an “echo” channel to fill out the sound with pseudo reverb.
My reason for getting into it is to fix a bug in the original game. One of the “special effects” allows it to fade out one song, then start another (e.g. battle or shop music) on an alternate set of data structures. Then when that music ends (battles ends, leave the shop) the previous music fades back in without restarting. This can sometimes fail to fade back in and instead the game is left silent. So I’m understanding that secondary channel set and how it handles this sequence. The music data itself is secondary - but it would be great to have a way to edit or compose data for a given engine, maybe a superset of the various features seen in games. |
|