Sonic and Sega Retro Message Board: SMPS in Sonic & Knuckles Collection - Sonic and Sega Retro Message Board

Jump to content

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

SMPS in Sonic & Knuckles Collection New 8/24: 1-up jingle resumes music

#1 User is offline MainMemory 

Posted 04 May 2014 - 01:05 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
The HQ music hack is great, but I've wondered if it would be possible to play the original SMPS music. A few days ago, ValleyBell pointed me to the source code of SMPSPlay and over the course of several days we were able to hack together something that played only S3K's music and worked with S&KC.

You can download SMPSOUT.DLL here. To use it, simply extract it to Sonic & Knuckles Collection's install folder, and rename it to MIDIOUT.DLL (or MIDIOUTX.DLL to use it as a fallback for the HQ music hack).

Features:
  • SMPS playback by ValleyBell
  • Plays Sonic 3's midboss theme in Sonic 3 mode
  • Speed shoes and special stage speedups work perfectly
  • Doesn't make S&KC run faster than it's supposed to


The source code is up on Sonic Retro's GitHub, and I may add support for an INI file specifying whether to play the S3 or S&K version of applicable songs.

Requires Visual C++ 2013 Runtime.
This post has been edited by MainMemory: 24 October 2015 - 05:10 PM

#2 User is offline Tiddles 

Posted 04 May 2014 - 05:24 AM

  • Diamond Dust
  • Posts: 471
  • Joined: 25-December 09
  • Gender:Male
  • Location:Leicester, England
  • Project:Get in an accident and wake up in 1973
  • Wiki edits:31
Aha, brilliant. Love the SMPSPlay sample clarity. I'd say it's nice to play S&KC with the proper instruments, but it's actually never nice to play S&KC. This certainly improves the experience though!

A couple of observations you may already be aware of:

  • S&K Knuckles' theme seems to be using the drum clap from S3 Knuckles/Miniboss instead of sample that replaced it in S&K.
  • There's the odd dropped note here and there, most obviously at the beginning of Sky Sanctuary. I don't know if it's exactly the same issue, but it sounds very similar to what happens in v1-v2 of flamewing's improved S&K driver due to a fix to make certain note/rest/duration sequences work like S1/S2, when some S3 music actually relies on the S3 behaviour.

I don't suppose there's any practical way to make fading work in S&KC? That would make things sound quite a lot better I think. I guess it'd somewhat depend where the code for that sits - I'm hoping they were lazy enough to still send E1/E5 to the sound engine and have midiout do something appropriate.

Those default sound effects sound especially rough compared to the music now, too! I seem to recall there are tools to improve this. I wonder if SMPSPlay could be used to pre-generate high quality SFX to be packed into the right format to replace the existing ones.

But anyway - fantastic stuff! If you wanted to do a version of this with the SMPS conversions of the unique PC tracks ValleyBell did for S3C, I'd be happy for that to happen if he is.

#3 User is offline MainMemory 

Posted 04 May 2014 - 08:47 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I was missing a couple of configuration settings that were making Sky Sanctuary play incorrectly, which have now been fixed. As for Knuckles' theme, it should be switching that sample whenever it switches between S3 and S&K tracks, and the S&K version is default, so unless I got them switched, it shouldn't be playing the S3 sample in the S&K track.

The game does check for track E1 and stop the music, so it may be possible to add a fade out command.

You recall correctly, my SKCsnd tool has options to change the sound effect format.

Having SMPS versions of the S&KC music sounds like a fun option for the next major release.

#4 User is offline MarkeyJester 

Posted 04 May 2014 - 12:42 PM

  • The architect of the universe, didn't build a stairway, leading nowhere.
  • Posts: 1807
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
Fantastic work guys! I was idling in the channel watching you guys have at this, you've put a great deal of work into it!

Is there a possibility you could post a few say; YouTube videos(?) of how the music sounds with this new driver? I'm interested, but don't really have the time to go digging through for my copy of S&KC, just to hear what you guys have accomplished.

#5 User is offline Tiddles 

Posted 04 May 2014 - 02:54 PM

  • Diamond Dust
  • Posts: 471
  • Joined: 25-December 09
  • Gender:Male
  • Location:Leicester, England
  • Project:Get in an accident and wake up in 1973
  • Wiki edits:31

View PostMainMemory, on 04 May 2014 - 08:47 AM, said:

As for Knuckles' theme, it should be switching that sample whenever it switches between S3 and S&K tracks, and the S&K version is default, so unless I got them switched, it shouldn't be playing the S3 sample in the S&K track.
I had been using the sound test, but I just did some more testing. It definitely works properly if you start S&K as Knuckles and listen to it there, but if you go into the sound test, play 00 (S3 opening theme) and then play that track again, it will have gone back to the S3 DAC, and it always seemed to use the S3 DAC if I started S3&K at AIZ (from a saved game, for what it's worth). So it seems like it might be switching itself to S3 mode a bit too readily and never coming back. flamewing's driver simply remaps the S3 versions onto new sample IDs (D8/D9 I believe?) and that's always worked well for S3C, so that's one possible route; in the olden days of poking at the binary sound driver, I used to just remap the DAC pointers each time one of the affected tracks was requested.

View PostMainMemory, on 04 May 2014 - 08:47 AM, said:

Having SMPS versions of the S&KC music sounds like a fun option for the next major release.
Along with that, the INI file you suggest for swapping S3/S&K tracks would obviously be something I'd personally enjoy - I guess all of these options could probably be consolidated in such a file.

#6 User is offline MainMemory 

Posted 05 May 2014 - 11:32 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I've updated the DLL with two new features: track selection via INI, and fadeouts.

The INI file should be named SMPSOUT.ini, and may contain the following entries:
TitleScreenTrack=S3 or S&K
MidbossTrack=S3 or S&K
KnucklesTrack=S3 or S&K
1UpTrack=S3 or S&K
InvincibilityTrack=S3 or S&K
AllClearTrack=S3 or S&K
CreditsTrack=S3 or S&K


This post has been edited by MainMemory: 05 May 2014 - 12:58 PM

#7 User is offline Tiddles 

Posted 05 May 2014 - 01:48 PM

  • Diamond Dust
  • Posts: 471
  • Joined: 25-December 09
  • Gender:Male
  • Location:Leicester, England
  • Project:Get in an accident and wake up in 1973
  • Wiki edits:31
Ah, beautiful job on the fading! I always thought that was one of the clunkiest things about the music in S&KC, so that's a great fix.

(As it happens, the video does demonstrate the Knuckles' theme DAC issue - compare that to how it sounds if you start up S&K mode and listen to Knuckles' opening.)

#8 User is offline MainMemory 

Posted 05 May 2014 - 02:23 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Turns out, I had forgotten to set the flag indicating which sample was in use. I added one line and it's all fixed.

Now I just need those S&KC music files you use.

#9 User is offline MainMemory 

Posted 06 May 2014 - 04:02 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Thanks to Tiddles, I have added SMPS versions of the S&KC music, and the credits song from the Sonic 3C prototype. As it is now, the SMPSOUT.ini file format looks like this:
TitleScreenTrack=S3 or S&K
CarnivalNight1Track=MD or PC
CarnivalNight2Track=MD or PC
IceCap1Track=MD or PC
IceCap2Track=MD or PC
LaunchBase1Track=MD or PC
LaunchBase2Track=MD or PC
MidbossTrack=S3 or S&K
KnucklesTrack=S3, S&K or PC
ContinueTrack=S3 or S&K
CompetitionMenuTrack=MD or PC
1UpTrack=S3 or S&K
InvincibilityTrack=S3, S&K or PC (uses unused track)
AllClearTrack=S3 or S&K
CreditsTrack=S3, S&K, S3C or PC

I have also added per-game settings. Any settings in a section named [S3K], [S&K] or [S3] will only be in effect when playing those games, and all settings in the root section will always be in effect unless overridden by a per-game setting.

The S&KC tracks have been left out of the source code on GitHub at Tiddles' request.

Edit: I've fixed IceCap 2's track selection and added the S3 Continue theme at Tiddles' request.
This post has been edited by MainMemory: 06 May 2014 - 11:12 PM

#10 User is offline MainMemory 

Posted 26 May 2014 - 04:58 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
ValleyBell has done a bit of work recently which has resulted in a new feature: by setting the BGM mode to FM Synthesizer in RUNSONIC.EXE and adding the line FMDrums=True in SMPSOUT.ini, you will get FM drums instead of DAC drums.
Additionally he has added some new tracks:
  • A version of S3's invincibility based on S&KC's version of that track, available with InvincibilityTrack=S3PC.
  • The credits music from the 0525 S&K prototype, available with CreditsTrack=S&K0525.
  • The all clear music from the 0525 S&K prototype, available with AllClearTrack=S&K0525.
  • The title screen music from the 0525 S&K prototype, available with TitleScreenTrack=S&K0525.

Additionally, I have added a feature myself: for any track, you can specify Random to have it play a random track from the available options.

#11 User is offline MainMemory 

Posted 03 June 2014 - 02:57 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
One last feature from me: for any track (including ones that previously had no options) you can specify MIDI to have it fall back on the original MIDI track, as long as the original MIDIOUT.DLL is named MIDIOUTY.DLL. This makes it possible to have the HQ music mod fall back on the SMPS music mod, which itself falls back on the original MIDI tracks.

#12 User is offline MainMemory 

Posted 22 August 2014 - 10:25 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Since the contest is nearly over, I suppose I should make an update post.
When I entered this in the contest, I figured I should add a new feature for it, and chose to go for Sonic 3D music, because it's the same SMPS version as S3K with a few different DAC samples. So ValleyBell got the coding set up and I added in the tracks where I felt appropriate.
I also added a new feature to the config tool: song previews.
Posted Image
With this feature, it's now possible for people without S&KC to download the mod and just listen via the config tool, and it's possible for any program that supports C interop to use SMPSOUT.DLL to play music.
I also recorded a couple new videos:


This post has been edited by MainMemory: 17 July 2017 - 11:13 AM

#13 User is offline MainMemory 

Posted 19 September 2014 - 11:41 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3900
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Early today, ValleyBell made a commit that enabled the player to play S1 and S2 music. As I went about adding the new music in, I realized that the method for adding a song was really dumb, requiring editing no less than five places in the code. So I wrote a program to parse a couple of INI files for song info and generate the necessary data structures, then added in all the music from S1, S2 and S2Beta. Then I updated SMPSCFG to use the ini files too. Unfortunately it appears there is a bug that causes S2Beta songs to crash S&KC, but not SMPSCFG (or the SMPSPlay program), and since ValleyBell just left for a two week vacation, I had to remove them by way of commenting them out. I fixed it, and now they work fine.

TL;DR S&KC SMPS Player can now play all the music from Sonic 1 and Sonic 2.

Potential future features:
  • Music resume after 1-Up (current SMPSPlay supports it, SMPSOUT's driver will need updating)
  • SMPS sound effects (again, driver will need updating)

This post has been edited by MainMemory: 20 September 2014 - 06:36 AM

#14 User is offline MarkeyJester 

Posted 20 September 2014 - 03:19 AM

  • The architect of the universe, didn't build a stairway, leading nowhere.
  • Posts: 1807
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
Hah, this just gets better and better guys, fantastic work! It's really enjoyable seeing this go above and beyond expectations!

Just curious here. Is there a chance we could have the SFX looked at for improvement?

I'm aware they're samples at a low quality rate, but perhaps it'd be interesting to have those SFX played by the SMPS driver itself like they initially were, maybe even altering the software for the SMPS driver to extend and in-place additional FM and PSG channels specifically for SFX to avoid music interruption, perhaps an option to allow the player to select between; SFX interrupting standard channels, or using their the additional in-placed channels.

Or if that seems like quite a steep task not worth doing, then at least rerecording the SFX from the original title at a higher rate?

#15 User is offline nineko 

Posted 20 September 2014 - 05:22 AM

  • I am the Holy Cat
  • Posts: 5554
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
MainMemory himself said that SMPS sound effects are a possible future improvement.

For now you can indeed replace the recorded ones with higher quality ones, both MainMemory and I released programs to do so, just keep in mind that the PCM format is hardcoded inside the executable and affects the whole game; it's easy to change that format of course, it's a known byte, but then you'll have to replace all the sfxs with higher quality ones. I did try to do that years ago, but the game gave me some problems with 44100Hz waves, not sure why, maybe I did something wrong (I wouldn't be surprised), some sfxs "clicked" at the end, even if my recordings were good.

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

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