Author Topic: [FF6] [OPEN BETA] Dancing Mad - FF6 Audio Replacement using MSU-1  (Read 168042 times)

insidious611

  • *
  • Posts: 150
    • View Profile
So, I was rather inspired by DLPB's soundtrack mods for FF7, and FF8, by this old thread nobody really replied to, by FinalFanTim's remixes, by OCRemix Balanche & Ruin, and by documentation of the MSU-1, to attempt a mod to replace the audio of FF6 with higher fidelity/remixed versions.
So without further ado...
PLEASE NOTE THIS FIRST POST NEEDS UPDATING
What is this?

Dancing Mad is an Open Beta mod to enhance the audio of the SNES game Final Fantasy 6 (3 in the US). Put simply, it replaces the SPC (SNES sound chip) based audio of FF6/FF3 with the official OST, or optionally, a number of other sources of remixed/remastered FF6 music.

Why?

Two reasons, really. For one, I have been feeling lately like I want to give myself challenging projects that involve areas outside of my comfort zone. I've not done much ROM hacking (at least, without tools) before, and my experience with ASM is mostly 6502 and a smattering of x86. So this is new territory, and that's exciting and promising. It's my belief that you should always endeavor to learn new things.

The second is that there are a fairly large number of really good remixes, arrangements, etc of the Final Fantasy VI soundtrack that fit well with the game but sound better than the original SPCs, and I wanted to see these as part of the game itself and give the game a little modern color and flavor.

off course, in terms of the OSV, the difference is admittedly somewhat minor. As far as I can tell, the OSV tracks were essentially rendered *from* the SPCs in a way. The difference in quality is there, mostly coming from slightly cleaner samples, better resampling and a samplerate of 44100Hz instead of 32000Hz, but it's quite hard to notice.

Where can I download it?

THE OPEN BETA IS NOW AVAILABLE HERE
Development occurs on my GitHub, which is here

What Songs?

This mod will contain audio from at least these 6 sources, converted to MSU-1 PCM format.

1. FLACs of the official FF6 OST.
2. MP3s of FinalFanTim's "Unreleased Tracks" FFVI Remaster project.
3. FLACs of the OCRemix Balance & Ruin remix album.
4. FLACs of Sean Schafianski's Final Fantasy VI Remastered project. (Buy it! It's on iTunes and Loudr and it is glorious)
5. MP3s of Final Fantasy Acoustic Rendition
6. MP3s of ChrystalChameleon's FF6 remasters.

You will be able to choose which specific audio files you want to install, or you can choose one of 8 predefined selections:

1. The FF6 OST itself
2. The FinalFanTim MP3s plus the OST
3. The OCRemix Album, plus the OST for Grand Finale?, What?, and Celes.
4. Alternate loops of the OCRemix album provided by qwertymodo
5. The Sean Schafianski Remaster plus the OST
6. The Final Fantasy Acoustic Rendition plus the OST
7. ChrystalChameleon's FF6 remixes plus the OST
8. My own selection of a mix of the four, based on what I feel best captures Nobuo Uematsu's original intent. Entirely subjective here, don't like my selections, don't use them.

In addition, other tracks are included for you to select from that don't fit any of the above. This includes Opera music by the Tokyo Symphony Orchestra (currently disabled due to coding difficulties :( ) as well as music contributed by fans and other contributors to the project.
I may also include some misceallaneous tracks if I find good ones, such as OCRemix tracks that aren't bart of Balance & Ruin, or orchestral/piano tracks, etc.

What will I need?

You'll need a copy of FF3us to start with, I plan on supporting FF6j later. Patched versions should work, unless they touch the audio code or move things around addresswise. (No translations that extend script size!)

As far as playing this, you will need either bsnes/higan (I plan on targetting bsnes v075 as a baseline as people seem to have had the most success with this version as far as MSU-1), or the actual SNES hardware and an SD2SNES flash cart. (I do not by any means have the money to purchase one of these for myself, so I'm going to need people's help testing this.)

How?

This project will use the MSU-1 "addon" developed by Byuu. This addon is much like the SuperFX, S-DD1, or SA-1 chips in released SNES games, except that, other than in the case of the SD2SNES, there is no physical hardware implementation. This addon allows me to stream data, in this case audio, at 2.68Mbit/s from a data file seperate to the ROM itself. This add-on is essentially intended to be everything the SNES CD was supposed to be, and more. Other people have added remastered BGM to other games before (See A Link To The Past for one of the few publically released versions... I have no idea why people are so guarded with their MSU-1 hacks.), and a few have even added FMVs to SNES games. (I may eventually try to port the PSX FMVs, but that would be a seperate, compatible mod.)

I will point out that I admittedly have little to no grasp of SNES ASM beyond basic SPC routines, the MSU-1 documentation, and my knowledge of how ASM works in general. So the patching part of this project is expected to be slow going, initially buggy, and potentially arduous. But, from what I've seen the MSU routines are relatively simple, and I don't plan on giving up, as I would personally love to see FF6 modded with better music.

This project has been completed before by someone by the handle of Drakon (see YouTube) but he refuses to release his IPS file, sources, documentation, or literally anything that would actually allow you to play his efforts, so in the spirit of the Open Source community, I'm going to redo it and release it to everyone.

This project is going to end up being one of two things on the user end. 1. A rather large download or 2. A rather long install, as either I'm going to have to pack in the uncompressed raw PCM files or a script to manually decode and convert them on the fly.

How Can I Help?

Testers, *especially* SD2SNES testers, of the Open Beta are wanted. Specifically, I'd like people to pay special attention to the Opera scenes and make sure those are functioning properly.
In addition, people with experience dealing with SNES assembly, NMI routines, and most helpfully, editing FF6's specific NMI routine without causing issues, are critically needed to help with the fading issue. See the github issue HERE. Please fork and make pull requests!

Current Status?

2015-04-25
We have liftoff! The project is working, we have officially succeeded in getting FF6 to play our songs! See the video section.

2015-09-28
We have a private alpha! Complete with a convenient installer (with dynamic track downloader), readme (with credits), and all the files necessary for playing the game besides the ROM itself (please supply your own unheadered FF3 US V1.0 ROM). See this post for details.

2016-06-03
We have an Open Beta! See links above.

2017-09-17
After a long hiatus, work is proceeding on fixing some issues with the installer, as well as fixing some project organization issues. Work has moved from BitBucket to GitHub.

2019-01-06
Dancing Mad is currently working and mostly feature-complete on Japanese, and US V1.0 and V1.1 ROMs. madsiur is still working on fading code.


This is taking too long! When is it going to be done?

When it's done. Any replies to this effect will be ignored, summarily. I encourage moderators and admins to discourage such talk in general. This is a project I definitely want to do, as an educational project for myself if nothing else, but I have other projects, other obligations in life in general, a fiancee, contract work, StreamStatus, game development, and other things I also work on. So progress may at times be slow, or may halt altogether. Be assured, I'm not going to give up on it.

Progress Videos!

Very Old Alpha
https://www.youtube.com/watch?v=4WHT98HBgpE

First working proof of concept
https://www.youtube.com/watch?v=vKgSqG2Tbfc
« Last Edit: 2019-01-06 12:30:38 by insidious611 »

insidious611

  • *
  • Posts: 150
    • View Profile
I'm headed off to bed, but I've begun the process of creating the .pcm files (which involves rather tedious amounts of trimming, pinpoint exact loop sample checking, and testing.) I have the .pcm files for all 3 versions for track 2 and track 1, though the OCRemix version actually has two options for track 1 (the opening): The native tempo, which is completely out of timing with the actual game past about the 2 minute mark, and uptempoed to almost match the OST.

insidious611

  • *
  • Posts: 150
    • View Profile
EDIT: Since this progress table was long since out of date it's been removed. All tracks from all the original sources have been looped and tested at this point.


Update! 7/13/15

Due to issues with timing and properly splitting the music, the OCR versions of the Opera tracks have been removed and replaced with another fan remix.These replaced tracks are converted, looped, and tested. These also include replacements for some of the tracks the OCR was missing, such as Grand Finale and iirc What??.

Update! 10/7/17

GitHub user edale2 has been helping normalize the audio, and providing a few more alternate tracks, including some Black Mages covers. Expect these in the next release of the installer.
« Last Edit: 2017-10-07 22:05:04 by insidious611 »

insidious611

  • *
  • Posts: 150
    • View Profile
So, Covarr and I have been talking about the Opera Sequence, because it's... a mess, in general. Even if we forget the fact that it's musically interactive and rather tightly timed in the original, the OCRemix versions, which I definitely would select because they're *amazing*, concatenate two parts into one in one place, and add or change a bunch of lines.

Not to fear though, I've not given up.

It's likely that the first release will just have the normal SPC sound for this sequence, and that a later release will address these plans, but in any case, the plan is to retime the sequence entirely ourselves for the OCRemix version. The text display will be removed, and the "mouth flaps" will be redone to match the extra lines/words, and the timing fixed. This is going to be a pretty massive undertaking but imo it's necessary. When we get to this point, *ANY* help that *ANYONE* has regarding SNES ASM would be *extremely* welcome.
« Last Edit: 2015-04-23 02:59:05 by insidious611 »

insidious611

  • *
  • Posts: 150
    • View Profile
This bit is mostly here to provide notes for myself because I have a nasty habit of losing important info in hard drive crashes:

FF3us Important RAM Map:
$1301: MusSongID
$1302: MusVolume

Important hardware registers:
$2140-$2144: SPC Communications Registers
« Last Edit: 2015-04-24 22:27:25 by insidious611 »

insidious611

  • *
  • Posts: 150
    • View Profile
Having done some investigations into how FF3's internal music handling works, I had to update a number of the tracks above to reflect new findings.

Covarr

  • Covarr-Let
  • Administrator
  • *
  • Posts: 3941
  • Just Covarr. No "n".
    • View Profile
I just wanna go on the record as saying OCRemix's "Dancing Mad" was a right pain. Had to make multiple versions with different loops, to be used depending on what ASM magic insidious611 is able to pull off, which was made really fun (difficult) by the fact that the OCRemix version of this song was meant to be listened to as a single piece; the remixer quite clearly never expected anyone to try and tear it apart in the middle to restore the original loop points from the SNES game.

I imagine the opera will require even more extensive audio editing, in addition to whatever ASM work insidious611 does with the timing. I can't wait, this is the most fun I've had on a project in a long time.

insidious611

  • *
  • Posts: 150
    • View Profile
Guess what!

We have liftoff! The game is playing our tracks!

There's a bunch of bugs to fix, but lets celebrate what we have with a video.

https://www.youtube.com/watch?v=vKgSqG2Tbfc

obesebear

  • *
  • Posts: 1389
    • View Profile
Very nice work.  Glad someone's taking the time to improve ff6 a little bit

insidious611

  • *
  • Posts: 150
    • View Profile
Current Bugs:

* (Maybe fixed) Playing game music and MSU-1 music together after battle. Hacked around by zeroing the game's internal music playing variables if MSU playing succeeds, that way it doesn't have anywhere to load from. Seems to work. Better fix would be to find out what routine is re-enabling internal music, but I haven't had success with that yet.

* (Not yet fixed, but fix proposed) Silence or looping Prelude (load screen music) on load of saved game. This is likely because  some or all of the internal music variables are being saved on game save and then loaded on game load, and because we've told the internal music routine to mute the music, it's being skipped. The possible fix? Hook the save routines and copy our variables in place of the game's. This *should*, as long as the game is calling the "new track" routine on load, mean we're playing the proper music on load.

I'm not releasing this until we've got three things, roughly in order:

1. Special handling working for at *least* Dancing Mad, we might be able to just work around The Phantom Train but we need to be able to play 3 different loops for the Dancing Mad tiers even though there's only one internal track for it.

2. All of the music for all of the versions looped and trimmed.

3. A full playthrough of the entire game with everything working, on Higan, Bsnes (though on Bsnes SPU fallthrough on missing track won't work) and, if I can find someone with an sd2snes or afford one for myself, sd2snes, with MSU-1 music working for everything *but* the opera. Also, a full playthrough of the game on an emulator that doesn't support MSU, to make sure we aren't breaking things.

The opera is likely going to be left for a second release because it's going to involve *major* hooking of routines and timing issues, so for the first release it's probably going to be left to SPC only.
« Last Edit: 2015-04-26 05:49:58 by insidious611 »

insidious611

  • *
  • Posts: 150
    • View Profile
obesebear: I plan on doing more FF6 improvement after this, but I'm focusing on this for now and am not going to announce my next plan until after this is release-quality. I noticed FF6 getting a lack of love too, and wanted to fix that. :P

insidious611

  • *
  • Posts: 150
    • View Profile
Today is a good day! We've finished the OCRemix album completely. Well, other than figuring out what to do about the Opera tracks, anyway.

Also, I may have fixed a couple bugs, but I'm not sure yet. Heck, I may have caused a bunch more. We'll see.

Hellbringer616

  • *
  • Posts: 1913
    • View Profile
Would it be possible to port this over to the GBA version? that is the version i play as it has a bit of extra content.

If not... Know of any hacks that port over the extra content? haha

Covarr

  • Covarr-Let
  • Administrator
  • *
  • Posts: 3941
  • Just Covarr. No "n".
    • View Profile
Would it be possible to port this over to the GBA version? that is the version i play as it has a bit of extra content.
Nah, this isn't doable on the GBA for several reasons:
  • This hack relies on the MSU-1 expansion chip for SNES, which completely bypasses the SNES' audio system. The GBA does not have the hardware to bypass its internal audio system, no matter what extra chips you may put on the cartridge. Streaming audio is not impossible, but it'd sound like crap routed through the GBA's audio hardware.
  • A GBA cartridge is hard-limited to 32MB (256Mb). This project is going to be several gigabytes. Admittedly this is mostly due to uncompressed audio, but even with compression it'd have to be extremely low-quality on GBA to fit into 32MB. This would sound worse than what the GBA version of the game already has. As far as I'm aware, only one cartridge, Shrek 2 (literally just the movie), ever exceeded the 32MB limit, and it did so with some weird tricky bankswitching magic that wouldn't work with an actual game.
  • Even if you could somehow compress the streaming music to fit and still maintain acceptable quality, the GBA is not equipped for realtime decompression. There's some homebrew MP3 players, but they are CPU-intensive enough as not to leave any room for anything else, such as gameplay.

Really, the only reason this is possible is because the SNES has an extra couple of pins that games don't use (except the Super Game Boy, which uses it to directly stream GB audio), which the MSU-1 chip takes advantage of; it is not limited by SNES restrictions. Without similar pins, it's not even possible to make a physical hardware expansion to make this possible on GBA.

If not... Know of any hacks that port over the extra content? haha
I remember reading about a hack that backports the GBA version's translation to SNES. Dunno if it was ever completed or what. AFAIK it didn't port any of the other extra content, though.

For what it's worth, there is a patch for the GBA version that ports the music from the SNES version (and possibly a better opera scene? I'm not sure, I never got that far with this patch). It's called Music Restoration patch, I think. It's not really the same as what we're doing, but it is definitely an improvement over the default audio which kinda sucked on the GBA port. I highly recommend looking it up. I'd provide a link, but my work internet blocks romhacking.net.

Hellbringer616

  • *
  • Posts: 1913
    • View Profile
No need, i already have a FF6 Advance patched with music, the palette correction, and a few bug fixes.

Once this is released i'll try and patch the patched GBA game, who knows, maybe it will work

insidious611

  • *
  • Posts: 150
    • View Profile
I'm probably going to need to put out a call for Alpha testers soon.

However, I need anyone who signs up for this to be aware of a few things vefore doing so.

1. It's an alpha test. In the classic sense, as in shit will be broken and I need you to both understand that and be able to tell me where, when, how, and in what context something broke, providing me with savestates if necessary

2. It's going to be at least a 3 gig download.

3. Nothing is to be released publically until the work is done. I find a subpar leak I strangle you with shielded CAT6

4. I'm going to need you to have a relatively deep familiarity with the game,and specifically any musical cues

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
As per IRC, I talked with Luksy about the opening FMV translation and we've come to:

Imperial Army, Special Directive:  Begin the invasion of Narshe, the coal mine city.

or

Imperial Army, Special Directive:  Begin the invasion of the coal mine city, Narshe.
« Last Edit: 2015-05-01 21:54:41 by DLPB »

theonyxphoenix

  • *
  • Posts: 22
    • View Profile
This is one of my favorite games of all time and I was hoping that it would have some MSU-1 love.  Unfortunately my knowledge to do this myself is sorely lacking, but I would be happy to test (and learn) to bugfix in any way that I can.

insidious611

  • *
  • Posts: 150
    • View Profile
Did a bit of a stream testing the game out earlier.
http://www.twitch.tv/insidious622/b/655660538

Following it, and my dissatisfaction with the fact the music was so loud you couldn't really hear the sound effects in battle, I applied a brute-force scaling of the volume down by 0x40.

This is *still* a bit loud but at least you can hear the sound effects in battle now.

saftle

  • *
  • Posts: 88
    • View Profile
I love the progress on this. MSU-1 hacks are amazing. Keep up the great work! :D

By the way, have you thought of making a version that would support the Re-Translation done by RPGONE (http://www.romhacking.net/translations/697/ )? I thought they did an awesome job. ChrisRPG did the programming. He passed away not too long after it got released, or shortly before. R.I.P. :(

Another cool rom hack that I've wanted to try was Brave New World. http://www.insanedifficulty.com/index.php/index.html/_/news/brave-new-world-160-released-r126.

If only those two hacks worked together.
« Last Edit: 2015-05-04 19:39:26 by saftle »

insidious611

  • *
  • Posts: 150
    • View Profile
Honestly, unless either of those hacks modify the sound routines or a certain, empty portion of ROM I'm using for my own stuff, it's likely they're both compatible. I'll give them a look through though.

I had a graphics card fail on me and that's kind of put a damper on my mood, so I haven't been working too hard on this lately. At the moment what I really need to do is do a comparative runthrough of the game with the mod and without it to see if there are any major issues of music not playing, or the wrong music playing. What I'd counted as a bug, the Narshe music playing until you get to Figaro, someone said might actually be a thing that happens in the original. So it's that kind of thing I need to test for.

Other than that, what I *really* need to do is get fading working so that music transitions aren't so rough, but that requires hooking the NMI so that I can time said transitions, and that's not the easiest thing in the world.

Also, I still really need to figure out how saving and loading works for the music routines, so that I can get it playing the right music on game load.
« Last Edit: 2015-05-06 00:03:56 by insidious611 »

insidious611

  • *
  • Posts: 150
    • View Profile
Hrm.. I'm not sure I'm going to be able to actually fade between tracks... There's two things preventing me from doing it, one of which I might be able to work around but one I know I can't.

The one I might be able to work around is that I need to do anythingthat involves timing during the NMI which is fairly short, and not long enough to wait for a track be loaded and check if it's missing.

The second one, which I can't work around and which is fairly important to keeping things functioning, is that if I'm changing tracks during a time that's not during the SPC loading routine, I can't do the fallback to the normal routine if a track is missing, such as in the case of wind sound effects and other "songs" I don't handle.

So I think we're going to just have to deal with the sudden track changes without fades. :/ That makes me unhappy but I can't really see a way to avoid it atm.
« Last Edit: 2015-05-07 08:02:57 by insidious611 »

theonyxphoenix

  • *
  • Posts: 22
    • View Profile
I know that the Narshe music did continue until you reached Figaro, if that helps at all.

Thank you for your continual work.  The progress you have made so far is great. I'm sure that the idiosyncracies will be resolved.

insidious611

  • *
  • Posts: 150
    • View Profile
First, a reply:

theonyxphoenix: That is actually really helpful since you're the third person to say that, which means that that's more than likely a "bug" we can cross off our list. Which means the only bug currently, other than missing fades, is no music on load of a saved game.

Now that my head is a bit less fuzzy, heres some technical details on the hurdles I'm working to overcome. If you don't want to deal with overly technical stuff, skip to the numbered "workarounds" at the bottom for an idea of the choices we have that *aren't* dangerous.

The NMI, or "Non Maskable Interrupt", is generic computing term for an Interrupt (basically a request to the CPU, literally 'interrupting' its current behavior) that must be handled if it's enabled. On the SNES, the NMI, if enabled, happens every VBlank, so once per field or roughly 60 times per second.

For the most part up until now I've been hooking the routines from the game itself, that is, taking requests the game makes to its own code and rerouting it to mine. For the fading, and for some later things I'm going to have to re: timing (the Opera scene and Dancing Mad during the final battle, among other things), I am now hooking into the game's NMI routine, which means I can run code every frame. I'm using stack manipulation to make sure that I don't harm the game's own NMI handling in the process.

Now, the fading itself is pretty simple. Reduce or increase the volume of the MSU every frame until we've gotten to our desired volume (or close to, since I'm reducing by 5s). The problem comes when fading from one track to another. Currently, we're hooking the game's "new track" routine and immediately switching to an MSU track and playing it, falling back to the game's own SPC routines if a track is missing or unplayable. This allows us to handle looping sound effects like wind and train sounds that are implemented as "songs" in the game but which we don't want to have to do on the MSU. To do the fading, however, we need to, when we're told to switch to a new track, store the requested track and a variable telling my NMI routine that we're fading out and into a new track in RAM, since this needs to be handled over time.

However, this means that the NMI routine, the one that runs every second, needs to handle the actual switching of tracks. Which is a problem for two reasons. One, you need to loop after loading a track and wait for it to be loaded and ready to play before you can play it. This is done because Byuu wanted to make it possible for the MSU-1 to be implemented in cheap, slow flash memory or even as a CD. This loading loop takes less than a second in higan, but we can't assume it will take any specific amount of time. And the NMI only lasts a tiny fraction of a second itself. If I'm still in NMI code when the NMI ends, massive graphical corruption can result, so anything I do during it needs to be only a few instructions long.

We can work around this problem by using the "60 times a second" nature of the NMI. We can set the track to load, set some variable to tell my NMI routine we're waiting for a track to load, and check if it's loaded every frame. On Higan, this might actually be marginally slower than just looping to wait for the track since I'm not sure it even takes 1/60th of a second to load a track, at least on my machine, but it should be fast enough. Then, we would play the track once the MSU states that it's loaded, or, deal with it if it's a bad track.

Which leads to my second problem. Currently, if we detect a "bad track" (one that's missing, in the case of the wind or train scenes, intentionally), we handle it very cleanly: Since we're already in the game's native music loading routine when we're switching tracks, we just return to the routine we were called from without muting the SPC.

However, if we're doing the switching and playing during the NMI, we don't have a routine to return to, so there's no way to fall back to the original SPC routines... Except...

There is a workaround that might work to do this, but it's *extremely* messy and I don't particularly like it:

If we've got a bad track, we can load the correct stuff in the correct RAM spots and registers and "jump" to the original SPC routine, an instruction *after* the point where I hook it into my routine, effectively going into the game's original code to call for a new track in order to deal with our missing track. The problems?

For one, we'd be doing this during an NMI. I'm not sure if the game's SPC code is short enough to be called during an NMI, it's generally called during scene transitions during which the screen is blank and the NMI is disabled (which, we can't very well disable the NMI during the NMI). This could lead to graphical corruption or other bugs.

For another, we'd be at least 2 frames (or 1/30th of a second/0.03 seconds) behind the original call to load the song as far as loading the SPC version, which could throw timing off considerably.



Other workarounds?

Well, there's a few that come to mind at the moment.
1. We can abandon the idea of fading completely, keeping music transitions their current sudden (but working and with simple, easy to debug code) selves.
2. We can do an extremely quick looped fade during our original routine (on the order of less than a frame). This *should* reduce or eliminate popping but won't really sound any less sudden to human ears.
3. We can do a version of the patch that has good fading but that has no fallback routines: Looping sound effects or missing music tracks won't play at all. This is already the case if you're running in BSNES v075 because the "bad track" routine in the MSU-1 was not implemented yet at that point. (which is why I suggest Higan or the SD2SNES when this hack gets released)
« Last Edit: 2015-05-07 08:55:26 by insidious611 »

theonyxphoenix

  • *
  • Posts: 22
    • View Profile
Is the twitch gameplay video without the fading?  If so, I really don't hear much of a problem with the transitions and I have played this game more times than I can remember. The only criticism I have is some of the tracks themselves.  Should one choose to do so, how easy would it be to replace a track?  Excellent work so far.  I apologize that my knowledge of the fading issue isn't more comprehensive.