[FF6] [OPEN BETA] Dancing Mad - FF6 Audio Replacement using MSU-1

  • Thread starter Thread starter insidious611
  • Start date Start date
Status
Not open for further replies.
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 edited:
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 edited:
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.
 
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 edited:
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.
 
Swapping in the replacement track file is easy. Converting it is less so, since it involves making a custom loop manually. Of course, if you don't mind a CD-style loop (fade out and restart), that becomes much easier, just toss a wav file into wav2msu.
 
It's worth noting that in the videos I'm working from almost entirely the OCRemix tracks. My final selection will be a mix, and you can choose to either go with that, go with the OCRemix tracks, go with the OST, or go with the OST supplemented with FinalFanTim's or Sean Schafianski's tracks. Or you can create your own completely custom mix from within the installer. There'll be kind of a table-based interface for choosing which to go with for each track if you choose to do a custom selection.

Also yes, the twitch gameplay video is completely fade-less. I noticed it particularly when the game suddenly switches from a lower volume version of Awakening to the full volume version after you specify Terra's name, but ehh, I guess it's not that obvious to others. :P
 
So I've only skimmed this thread, since all the technical stuff is over my head, but are you still having trouble with the Opera? It seems like the biggest roadblock in updating the game soundtrack, and it would take a lot of work, but as far as making it interactive I think would require new recordings/orchestrations from scratch -- particularly the singers. Is that the issue? Or is it more just a technical issue of playing simultaneous CD quality files with emulated SNES hardware?

Anyway I'd be willing to help with the orchestration and singing part if it's needed.
 
The plan, as I understand it, is to use the opera sequence from the OCRemix album. The problem is that this'll mean hacking in new timings for the scene itself, so that sprites hold the "open mouth" and "closed mouth" positions for different lengths of time. This is not impossible by any means; if Square could time it in the first place, then obviously it will be possible to re-time. But even after figuring out HOW to do this, it'll be immensely annoying and time consuming.

That said, opera tracks that match the game's original timing would almost certainly be welcomed. Ultimately it's up to insidious, not me, but I can't see how additional choices (especially something easier to implement with the game's original timing) would be anything but beneficial. But for that advantage to really make a difference, it'd have to sync perfectly with the existing lip flaps in the game, which might be a lot of effort and be severely limiting in terms of lyrics.
 
It'd be a rather grand undertaking in and of itself to redo the actual music for the opera. As Covarr said, we already have the redone music from the OCRemix album, the problem is entirely a programming one. Getting the time cues in the game to sync, not just the mouth flaps but the dialogue timings and the proper "you made the right choice, you made the wrong choice" stuff all working right is going to be a pain in the ass, as this is all stuff that the "new track" handler that we're overwriting in the game's code isn't used to handle, instead there's very specialized code in the game for handling that sequence musically.

This is the bit that's a pain, because we have to have our own very specialized code for this sequence. Our code for most other sequences is very simple and thus very easy to maintain. Dancing Mad and The Phantom Train are also going to need similarly specialized handling (though not as detailed) for only somewhat similar reasons.

To be honest, it's not quite accurate to say we're "still having trouble" with the Opera, though. Code-wise, I haven't even started with the opera. The way our code works, I can choose not to handle certain tracks and the game's native music code will handle it, so I'm having it to do that for the Opera for now, and haven't even begun the runs through the debugger required to set the stage for coding the opera stuff.


In other news, I've completed preliminary work on designing the installer, which is a vital step towards being able to get copies out to our alpha-testers.
 
Progress continues slowly. I've been focusing on some other things lately, but the installer is properly downloading tracks from my servers. Once I've finished that, finalized the last of the music (including deciding upon my selection), and run a test on the current patch code to make sure it hasn't been overtaken by gremlins or something (that is to say, to make sure it's still functioning the way it was last time I tested it), I'll be sending out alpha copies.

As far as when this will happen, Douglas Adams said it best when he said  “I love deadlines. I love the whooshing noise they make as they go by.”. That said, I hope to have an Alpha patch out to testers by the end of August.
 
I'm really interested by this project! Good work so far!

I was thinking implementing MSU-1 in FF6 myself, but since you started this project, I was hoping I could use your project as a base for mine (a more extensive hack). I have two question:

1) Have you succeeded in  hijacking the NMI routine in order to fade out tracks? A guy on a FF6 hacking forum reported the same graphical glitches when trying to implement MSU-1, I wonder now if it's possible to implement fading out with the NMI routine...

2) A number of event commands are use for song. Did you modify any or all of them? Here's the list. They are use in event sequence:

Code: [Select]
Code:
#  Bytes  Description-----------------------------------------------------------------------------------------------------------EF : 3    : Play song A with volume B. Song is actually A AND $7F. Bit 0x80 is unknown.F0 : 2    : Play song A, full volume.F1 : 3    : Fade in song A, with transition time B.F2 : 2    : Fade out current song with transition time A.F3 : 2    : Fade in previously faded out song with transition time A.F6 : 4    : Song tweaking, with various subcommands on first parameter. (not sure if can be applied to MSU-1)F7 : 1    : End most recent loop of currently playing song. (not sure if can be applied to MSU-1)F9 : 2    : Pause execution until music passes through point A. (Needs investigation, I'm not sure how that actually works).FA : 1    : Stop temporarily played song.
Once again, Good work!
 
Last edited:
Thanks for the event commands table! I've actually been hooking around the routine where the song selection and volume are pushed from RAM into the SPC and haven't touched those yet *but* they're probably going to be useful in investigating the current problem-tracks of Dancing Mad and The Phantom Train, which appear to be using maybe the F7 command to transition to various different "subsongs" within one actual in-memory song. We can't actually implement that in MSU-1, *but* we can trap those calls and implement them as transitions to different tracks, enabling the proper handling of those songs.

I haven't touched the NMI stuff too much since mentioning it because I want to get people testing it without the fading first, to make sure we have no major bugs in the current implementation and provide kind of a baseline so I know that if I broke something it's due to the NMI stuff.
 
Last edited:
With a couple minor exceptions, all audio work is now finished. I need to get the installer functioning 100% and then we'll see about getting it out to testers for feedback.

I have a bit of a problem though, and I'm going to be asking for a bit of feedback on this

The MSU-1 does not support seeking or resuming tracks. Therefore, if I stop one track and start another, it always starts at the beginning. This isn't an issue *except* during battle scenes, where you would maybe hear the first few strains of an area's melody, then the battle music because you got into a battle, then the victory fanfare, and then the area's melody would start over again. This leads to a large portion of different songs not really being hearable due to constantly being restarted. There's two basic solutions to this issue.

The first is basically to ignore the issue, have people just kind of deal with the restarting area music, maybe use a second track type to skip intros so it isn't as obvious.

The second is use the SPC (original style) music for battle and victory themes, merely fading out the MSU-1 area music before battle and then fading it back in afterwards. This isn't perfect either as it means you'll be "missing" a bit of the area melody when it fades back in (since it won't have stopped), but it's much better imo than restarting it every time.

The problem with the second idea off course being that that means the normal battle theme and victory fanfare will not be being replaced. The boss themes will be replaced as normal because they don't happen often enough for this to be a problem, but yeah.

My question is, which do you guys favor? Replacement of all tracks including battle/victory but area music restarting after battles, or leave the battle/victory music as is but have smoother music otherwise.
 
I'm personally a fan of the second option. A seamless audio experience is better than having to idle in an area to hear the entire song. On the world map, it would get pretty repetitive once you reach higher levels and can down most mobs with a few attacks.

However, both options would be even better, since I'm sure people don't agree with me.

Will you be potentially working on a solution later in order to not need either workaround?
 
Will you be potentially working on a solution later in order to not need either workaround?
This is a limitation of the MSU1 spec. It doesn't have any seek feature, and can only have one track loaded at once. If you load another, it will run from the beginning. No way around it unless Byuu creates an updated version (MSU2?), and adds support for it to his emulator (Higan/bsnes), as well as the SD2SNES cartridge adding support for the new standard. This isn't impossible, but it's not especially likely.
 
I would also vote for the second option. I know that this is probably a bad idea, but playing through the BNW hack it seems like a lot of the battle music tracks are ignored in certain areas like the Cult of Kefka tower, etc. Would it make it any easier to not have to switch back and forth as often.  Personally I liked this change in the mod in just about all instances.
 
Just wanted to pop in and confirm that leaving the battle/victory music using the SPC so that area songs can play all the way through is the direction we're going. The alpha I'll be giving out to select people soon may not have this feature (I'm planning on getting everything wrapped up in a nice package that can be easily tested so that I can make sure there's no bugs in the current implementation before I shake things up)

Progress is slow as I'm currently dealing with some issues in my life that make working on these things difficult. I'm currently on a two week vacation spending time with family away from these issues but it goes without saying I'm not working on my vacation :P. But I also wanted to assure people this is still a priority for me.
 
Enjoy you vacation and look forward to further developments.
 
Status
Not open for further replies.
Back
Top