Sonic and Sega Retro Message Board: smps2mid - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

smps2mid more than a proof of concept

#1 User is offline ValleyBell 

  Posted 10 May 2011 - 02:54 PM

  • Posts: 234
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
As a preparation for mid2smps, I wrote an smps2mid converter.
Now with source (Visual Basic 6), too.
Last Update: v0.4.3

It supports these ROMs:
- Sonic 1
- Sonic 2 (Final and Simon Wai Beta)
- Sonic 3
- Sonic & Knuckles (seems quite unstable)
- Sonic 3D
- Sonic and Crackers
- Oerg866's SMPS Player
- Sonic 1 SMS/GG
- Sonic 2 SMS/GG
- Sonic Chaos SMS/GG
- Sonic Triple Trouble
- Sonic Blast SMS/GG
A music pointer offset can be specified, so other ROMs are supported, too.
It's also possible to load raw SMPS bin-files. Offset correction has to be done via user input.
There's an auto-detection for 68k or Z80 SMPS format, as well as Sonic 1 SMS.

Most SMPS tricks (global tempo modifier and co.) are supported. It works almost 100%.
Tempo calculation should be 100% correct. (Sonic 2 Final, Sonic and Crackers and Sonic 1 SMS were verified with vgm logs.)

Bugs and issues (all non-Sonic-1):
- currently only the DAC notes for Sonic 1/2 Bass Drum and Snare Drum are mapped to the correct GM sounds
- the tool may display run time errors or stop commands and will close afterwards - this should happen rarely to never
- instruments may be out-of-tune because of strange key displacement values

On my TODO list:
- instrument mapping editor (for YM2612, PSG and DAC)
- making S3&K more stable (many music pointers seem wrong)
- Pitch Bend instead of Portamento Control
- Pitch Bend for modulation effects

Thanks to:
- all the people who contributed to the Music Hacking Guide
- nineko for the tempo calcuation algorithm
- saxman for the Sonic 2 music decompression

Comments and suggestions are welcome.
This post has been edited by ValleyBell: 07 October 2016 - 12:56 AM

#2 User is offline Tweaker 

Posted 10 May 2011 - 03:14 PM

  • Posts: 12389
  • Joined: 27-June 04
  • Gender:Male
Fantastic! I've been wanting something like this for a while. :D

Out of curiosity, do you have any intent to add support for the opposite? A no-frills MIDI2SMPS converter with proper pitch bend support would be a dream come true.

#3 User is offline Spanner 

Posted 10 May 2011 - 04:25 PM

  • The Tool
  • Posts: 3191
  • Joined: 02-June 07
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic Hacking Contest
  • Wiki edits:2,193
ValleyBell, have you had a look in the exported MIDIs in OpenMPT? Some of the instruments won't work until a few patterns later. Also, I assume it would be piss easy to get all other percussion to work, since my work usually has a lot more than the kick and snare.

Good work so far, though.

#4 User is offline nineko 

Posted 10 May 2011 - 07:00 PM

  • I am the Holy Cat
  • Posts: 5656
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
When will you stop being so awesome? :O

This is WAY better than the useless proof of concept I made several months ago... I'd send you my source code but I doubt you would have any use of it v.png

I can help with midi2smps if you'll want, though.

#5 User is offline PsychoSk8r 

Posted 11 May 2011 - 05:05 AM

  • HighKnights
  • Posts: 2580
  • Joined: 11-July 07
  • Gender:Male
  • Location:Walsall, UK
  • Project:30 Day Project: Revisited.A New Release!
  • Wiki edits:19
I would really love to see a MIDI to SMPS program.
What you've just given us though is great for something I have planned. :D

Edit: Ah, one thing I notice is that these Midis would be tough to work with, as the notes aren't arranged correctly into bars as they should be, upon inspection. Still a good tool if you want to listen to them though, or use on FL or something. =P
This post has been edited by PsychoSk8r: 11 May 2011 - 05:16 AM

#6 User is offline nineko 

Posted 11 May 2011 - 07:51 AM

  • I am the Holy Cat
  • Posts: 5656
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
QUOTE (PsychoSk8r @ May 11 2011, 12:05 PM)
Edit: Ah, one thing I notice is that these Midis would be tough to work with, as the notes aren't arranged correctly into bars as they should be, upon inspection.
This happens because the existing Sonic songs don't have a standard number of smps time units per quarter note (GHZ uses 16, most other songs use 12 or 24 to be able to use triplets), making it impossible to match note to beats automatically. Furthermore, we have no indication of the time measure(s) used in those songs. Sonic 1 Special Stage is a 3/4; Sonic 2 CNZ has a small measure as intro; etc. Too many variables which would need manual input to be gotten right.
This post has been edited by nineko: 11 May 2011 - 09:25 AM

#7 User is offline ValleyBell 

Posted 11 May 2011 - 09:35 AM

  • Posts: 234
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
Thanks for all the positive feedback.

QUOTE (SOTI @ May 10 2011, 11:25 PM)
ValleyBell, have you had a look in the exported MIDIs in OpenMPT? Some of the instruments won't work until a few patterns later.
No, I haven't even touched OpenMPT. About the instruments: an example would be nice.

QUOTE (nineko @ May 11 2011, 02:00 AM)
I'd send you my source code but I doubt you would have any use of it v.png

I can help with midi2smps if you'll want, though.
I'd like to read your source. Maybe I'll get some nice ideas.
I'll PM you about mid2smps when I have questions.

QUOTE (PsychoSk8r @ May 11 2011, 12:05 PM)
one thing I notice is that these Midis would be tough to work with, as the notes aren't arranged correctly into bars as they should be, upon inspection.
That's what the small text box with the title "Midi Res:" is for. Type 12 or 24 (or maybe 16 - just as nineko said) in it and the timing should be correct.
0 is some sort of auto-detection, but that's also affected by the calculated Tempo.
e.g. a BPM of 500 would cause it to increase the ticks per quarter so that you have 125 BPM which makes more sense than 500.

btw: I already have ideas for proper a PitchBend in SMPS files.

#8 User is offline Tanks 

Posted 22 May 2011 - 10:55 PM

  • Posts: 1017
  • Joined: 01-July 06
  • Gender:Not Telling
  • Wiki edits:1
As someone who loves to compile accurate midis from games... This is sex. I figured there was some roundabout way to do SMPS -> XM -> MIDI, but this just rips out the middle men. You, dear sir, deserve a god damn medal.

EDIT: If it's any help, I can get the BPM for the songs with the tempo issues. Just fixed up the Sonic 2 Race Results song with 60.9 BPM.
This post has been edited by Tanks: 23 May 2011 - 02:20 PM

#9 User is offline ValleyBell 

Posted 24 May 2011 - 06:00 AM

  • Posts: 234
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
Actually the tempo issue is already fixed.
I'll post an update in a few days.

#10 User is offline ValleyBell 

Posted 15 June 2011 - 01:43 PM

  • Posts: 234
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
The last few days I worked on smps2mid (not on mid2smps, as you might've expected).

And these are the new features:
- correct Tempo calculation for Sonic 2, Sonic 3 and later
- support for unknown ROMs (by adding a pointers from a custom address)
- support for extracted Z80 SMPS files with offsets different from zero
- detection for loop-in-loop with the same index (prevents hanging in Sonic 3D Green Grove 1's DAC channel)
- Surprise: support for Sonic 1 SMS (thanks to me for reverse-engineering the format specialed.png)

Thanks to nineko for the icon. (Actually his icon looked like this, with the MIDI below the Sonic head, not the other way.)

Link is here or in the first post.

Enjoy!

#11 User is offline nineko 

Posted 15 June 2011 - 04:02 PM

  • I am the Holy Cat
  • Posts: 5656
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
QUOTE (ValleyBell @ Jun 15 2011, 08:43 PM)
support for Sonic 1 SMS
I just tried this, and I will love you forever :O

By the way, the 8-bit Sonic games developed by Aspect (Sonic 2, Sonic Chaos, Sonic Triple Trouble) use a modified version of smps, so I wonder if you would be able to support them as well with a minimal effort. More details from here onwards. Pointers to Sonic 2 songs should be available with the disassembly, and I documented the ones in Sonic Chaos here: SCHG:Sonic_Chaos/sandbox. I can easily do Sonic Triple Trouble as well if you want (maybe I already did but I didn't keep them), I'd be glad to work with you on another project smile.png

edit: documented Sonic Triple Trouble for the sake of it: SCHG:Sonic_Triple_Trouble/sandbox.
This post has been edited by nineko: 15 June 2011 - 09:19 PM

#12 User is offline ValleyBell 

Posted 16 June 2011 - 01:22 PM

  • Posts: 234
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
I guess it shouldn't be too compilicated to support them too.
I'll have a look later. (I'll work on mid2smps first.)

Btw: SCHG:Sonic_the_Hedgehog_(8-bit)#Music_Hacking


#13 User is offline ICEknight 

Posted 18 June 2011 - 12:25 PM

  • Posts: 11099
  • Joined: 11-January 03
  • Gender:Male
  • Location:Spain
  • Wiki edits:18
I've noticed that some songs in SMS Sonic seem to play a second time without drums, and the "life lost" tune repeats four times, each with less instruments.

It sounds kind of cool, but I guess it's a bug. Nice update, in any case!

#14 User is offline ValleyBell 

Posted 19 June 2011 - 04:20 AM

  • Posts: 234
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
It's not a bug that the drums disappear when the second loops begins. It's just that the drum track is shorter/loops earlier than the melody tracks.
A good example is Green Hill Zone MD: The Noise track stops after a few notes, because the "master loop" is only one note long.

But the "life lost" tune shouldn't repeat - that's really a bug. (It's the only tune that lacks a loop start command - all other jingles have at least some empty loops.)

#15 User is offline ICEknight 

Posted 19 June 2011 - 10:41 AM

  • Posts: 11099
  • Joined: 11-January 03
  • Gender:Male
  • Location:Spain
  • Wiki edits:18
I see, that makes sense.


Something I was wondering is that, since MIDIs don't loop, is the general "track loop" info from the original file lost after conversion? Or is it still stored somewhere so converting the MIDI back to SMPS will loop like usual?


If it's not possible to convert to MIDI, then edit the MIDI, then convert back to SMPS with the looping melody intact, I beg you to add support for other non-MIDI formats like XM. It would make the usefulness of this application multiply by a bunch. Please.
This post has been edited by ICEknight: 19 June 2011 - 10:42 AM

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

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