don't click here

S3&K Collection (PC) HQ music hack [upd v1.3]

Discussion in 'Engineering & Reverse Engineering' started by angryzor, Apr 16, 2011.

  1. nineko

    nineko

    I am the Holy Cat Tech Member
    6,288
    475
    63
    italy
    Azu: short answer: no. Just open SONIC3K.DS2 in Goldwave as a raw pcm file (22050Hz, 8 bit, mono) to find out what's going on.
    The sound format (sample rate, bit depth, channels) isn't specified in that mini-header, there are only the file lengths in there, all the sound effects must be 22050Hz, 8 bit, mono, unless someone alters the exe file.

    I'm already working on a pcm importer/exporter by the way, it should be ready in a couple of hours, stay tuned.

    EDIT: also suggesting a split since I don't like to derail this music thread with discussions about sfxs.
     
  2. angryzor

    angryzor

    Member
    27
    0
    1
    S&KC HQ Music
    Just had a quick look and @file offset 0xa47c of sonic3k.exe is a 1 byte value that selects the sampling freq:

    0x00 = 11025Hz
    0x04 = 22050Hz
    0x08 = 32000Hz
    0x0C = 44100Hz
     
  3. nineko

    nineko

    I am the Holy Cat Tech Member
    6,288
    475
    63
    italy
    angryzor, when will you stop being so awesome? :O
     
  4. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,710
    301
    63
    SonLVL
    That's one of the parameters for the function I looked at to figure out the format.

    Also late, but I've found a library that should let me convert pcm <-> wav.
     
  5. angryzor

    angryzor

    Member
    27
    0
    1
    S&KC HQ Music
    Never! :specialed:

    ... as far as I know, WAV is PCM with a small header attached.
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,710
    301
    63
    SonLVL
    Not all wav files are 8-bit unsigned 22050Hz Mono. This library can convert them.
     
  7. nineko

    nineko

    I am the Holy Cat Tech Member
    6,288
    475
    63
    italy
    Have a first version of Sonic & Knuckles Collection Sound Replacer :)

    [​IMG]
    [​IMG] after I imported a file

    I wrote it in a couple of hours (literally!) so it might have some bugs, but it seems to work fine.
    Remember, all edits are cached, which means that you can import 9000 sound effects but they won't be effective until you click on "save", and you can discard all the changes by clicking on "revert".
    It can read a description file which must be named "sonic3k.txt" and must be placed in the same folder as sonic3k.ds2; if it doesn't exist (or is incomplete) then the sound effects won't have a name in the list. Note that sfx 1 in the sound test doesn't seem to exist so be careful when you label them. The format of this txt is simple: number, "description" (one entry per row)

    Have fun :)

    EDIT: fixed a small bug. Redownload if you downloaded it before I wrote this line. Also forgot to mention that I open the file for exclusive access, so if you run Sonic & Knuckles Collection while my program is still running you won't hear any sound. You have to close my program first, and run Sonic & Knuckles Collection afterwards.
    I also advise you to make a backup of the original SONIC3K.DS2 (not that it's hard to retrieve it on the internet, but still). Nothing should go wrong, but don't blame me if your SONIC3K.DS2 magically disappears and you don't know how to restore it :v:

    EDIT2: updated the pics
     
  8. Tanks

    Tanks

    Member
    1,048
    108
    43
    So... We going to get any love for BRSTM? It's the easiest of the VG streams to loop these days...
     
  9. angryzor

    angryzor

    Member
    27
    0
    1
    S&KC HQ Music
    Found out some more:
    If this value is OR'd with 0x01, the PCM is stereo.
    If it is OR'd with 0x02, it is 16 bit instead of 8 bit.


    It _should_ be supported through the vgmstream suppport. Does it not work?
     
  10. Tanks

    Tanks

    Member
    1,048
    108
    43
    Oh. Did not see that. if that's the case then yeah, it should work. I'll have to test it later. If that's the case though I can literally whip up the whole Sonic 3 VGM set in a matter of minutes.
     
  11. nineko

    nineko

    I am the Holy Cat Tech Member
    6,288
    475
    63
    italy
    Basically, if I get what you mean:

    0 11025Hz, 8 bit, mono
    1 11025Hz, 8 bit, stereo
    2 11025Hz, 16 bit, mono
    3 11025Hz, 16 bit, stereo

    4 22050Hz, 8 bit, mono
    5 22050Hz, 8 bit, stereo
    6 22050Hz, 16 bit, mono
    7 22050Hz, 16 bit, stereo

    8 32000Hz, 8 bit, mono
    9 32000Hz, 8 bit, stereo
    A 32000Hz, 16 bit, mono
    B 32000Hz, 16 bit, stereo

    C 44100Hz, 8 bit, mono
    D 44100Hz, 8 bit, stereo
    E 44100Hz, 16 bit, mono
    F 44100Hz, 16 bit, stereo

    This will definitely be useful if one plans to make a brand new SONIC3K.DS2 with high quality sound effects; personally I'd aim for format E since I feel it would be useless to have stereo sound.
    I might easily incorporate a selector of some sort in a new release of my program, but I don't think it would be a good idea. Changing the format requires the user to reimport ALL the sound effects to get them to sound right, so it's not something that should be done lightly.
     
  12. I love you so much for putting in BRSTM support. Gives me another use for the custom songs I downloaded for Brawl!

    However, for some reason I can't seem to replace song #55 (which I think is the S&K credits medley) with anything, regardless of whether I add "intro_" before the song ID or not. All I get is silence when I try playing it.

    EDIT: Never mind, I forgot about the bit in the readme about ending the INI with a new line to let the song register.
     
  13. Azu

    Azu

    I must be stupid. Member
    I like ADX better. Just as easy for loopping. Also, nineko, you're more awesome than I though. For the tool, and the avatar. The cat from Azumanga Daioh.
     
  14. nineko

    nineko

    I am the Holy Cat Tech Member
    6,288
    475
    63
    italy
    Thanks :)

    By the way, I crossposted my program here since I felt bad to derail angryzor's thread in this way. Also with a separate thread I can update the first post, publish it on the wiki, et al. But not now, it's almost 3:30am and I'll have to be in my office at 9am, this is what happens when I start programming something I like :U
     
  15. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,710
    301
    63
    SonLVL
    After a bit of hacking SADXsndSharp, I've made SKCsnd, which allows you to import and export WAV files.

    Edit: updated, now allows you to change the audio settings to any of the formats in this post. To use it properly, you'll have to Extract All, start a New file, change the setting, then Add all the files. You'll also have to change the byte in SONIC3K.EXE.

    Edit2: Wiki'd
     
  16. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    Is anyone else having trouble with the drowning music? I can't seem to get it to play anything, the music file I'm trying to use can be played on every other music slot I've tried, but nothing seems to work for the drowning music for me.
     
  17. angryzor

    angryzor

    Member
    27
    0
    1
    S&KC HQ Music
    Works perfectly here...
     
  18. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    I fixed it, I missed this part of the Read-me like an idiot, works perfectly now.

    Code (Text):
    1. | Please note that your last line must be terminated&nbsp;&nbsp; |
    2. | with a newline or it won't register.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |