Users browsing this thread: 1 Guest(s)
Music importer & randomizer

#1
Posts: 27
Threads: 2
Thanks Received: 0
Thanks Given: 0
Joined: Jul 2018
Reputation: 6
Status
Mental-Break
I've been kicking this around on Discord but I thought I'd post something about it here so more people can find it.

I'm working on a project that sort of independently extends/adjusts the Beyond Chaos randomizer, including adding/shuffling music. It's made for use with BC, but because of the way I'm building it independently, it's potentially a very capable tool for general FF6 hacking, whether you just want to replace some songs for fun or you want to change music extensively for a total conversion type hack. It's ... not very user friendly, and some things could stand to be documented better, but there's a chance it could make a few peoples' lives easier.

It's also very new and not very tested, so there's currently a good chance it could break your game. 

download here - requires python 2.7
includes a selection of custom songs (currently 118), some from the list here and some converted by me.


Q: "So random stuff is fun and all, but it's not my kink. How do you use this for hacking?"

It's probably worth a full tutorial once development is stable enough that it won't become obsolete in a week, but here's the basics:

First, if you are using this as just a music insertion tool, use ONLY mode 'm'. You can change the default mode in config.txt.

What songs are inserted, and where, is controlled by a config file called songs.txt.
There are two sections to this file: [Imports] and [SongSlots].
Each line in Imports defines a song that COULD be inserted (or moved), and lists the SongSlots that it could be inserted into.
Code:
ff4_baron: figaro, troops, returners

This import entry tells it that when it chooses a song to replace "Edgar and Sabin", "Troops March On", or "The Returners", one of the options will be the song stored in "ff4_baron_data.bin". Alternately, if the filename given starts with "ff6_" and ends with the identifier for a SongSlot, then if no file is found, it pulls the existing song from the ROM for that slot.
This means that if you want to insert a song or a set of songs without randomness, all you have to do is make sure that:
  • every Import entry has exactly one option -- e.g. "ff4_baron: troops"
  • None of those options are duplicate SongSlots -- e.g., if another entry is "ffmq_fossil: troops" then it will choose randomly between those two.
  • And finally, the SongSlot must be set to 100% probability to change.
A SongSlot looks like this:
Code:
1C: troops, 100
1C is the song ID -- the number the game uses to access it in events and such, as well as the sequential number in hex of the song pointer.
'troops' is an identifier used by this program in import entries and debug output. It can be changed to any word you like.
'100' is the probability (in percent) that the program actually processes this song. For non-random purposes this should always be 100. Even if it is set to 100, if there is no Import that mentions a SongSlot then that SongSlot will remain unchanged.

NOTE: No matter how little or how much you insert, this WILL shuffle around the location of every song in your ROM. A text file is output that gives the new locations. You can specify (in config.txt) the offset for existing music as well as any number of additional locations to insert the music to. There is an option that should leave existing music untouched and ONLY inserts new music, but last time I tried it it seemed to glitch several tracks, so use at your own risk.


Another mode that may be of interest to people -- not even hackers, just players -- as a bit of a mini-hack is 'b', which adds four additional song slots to the ROM and uses them for additional battle music. The idea is to implement something similar to Breath of Fire or Tales series games that "upgrade" your battle music as you progress the story. Currently, it finds the min and max monster levels and splits the range between those into five parts, then assigns those to formations based on average monster level in the formation. It doesn't seem very consistent though, so I will be working on other methods, including one based on earliest location fought. This mode also upgrades some battles that use regular boss music to use Fierce Battle (or rather, whatever replaces it), with higher probability to upgrade based on level. Again, the level scaling here seems not to be working well. But even in this early form, this mode is really fun! Try it out!
  Find
Quote  
[-] The following 5 users say Thank You to emberling for this post:
  • Gi Nattak (07-15-2018), madsiur (07-15-2018), NPCnextdoor (07-15-2018), SSJ Rick (07-16-2018), Warrax (07-16-2018)

#2
Posts: 3,966
Threads: 279
Thanks Received: 233
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Amazing work emberling! Also nice work on those SD2 and FFMQ songs!

I'll host your tool on the wiki in utility section if you don't mind : )
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • emberling (07-15-2018)

#3
Posts: 27
Threads: 2
Thanks Received: 0
Thanks Given: 0
Joined: Jul 2018
Reputation: 6
Status
Mental-Break
Working out some glitches, found out some stuff through test that I want to share early because it affects anyone using custom music from various sources in their hack -- or even using the music from the base game together with custom songs.

All of the songs in FF6 include the F7 and F8 commands at the beginning, usually F7 00 46 F8 00 00. Most of the custom songs posted here avoid these commands because they're prone to causing glitches.

Well, the thing is, avoiding the command isn't good enough to avoid the glitch. Anyone who's done their own music probably has noticed that reverb level (F2) doesn't reset between songs -- if you leave it out, you'll get whatever random reverb level was set in the previous song. F7 is also a reverb control. (I'm not entirely clear on it, but I believe they correspond to controls on a standard delay effect -- F2 as wet/dry, F7 xx as length, and F7 yy as feedback)

So if we go too far afield on our delay effect, we get glitches. The problem is, when you're mixing music from a bunch of different sources, some using F7 and others studiously avoiding it, eventually you'll run into a track that uses high F7 in a safe, controlled fashion (the intro to Phantom Train, for instance) -- and then switch to another song without F7 and everything blows up. It seems like the only ways to be safe are to either not include F7 at all (in something like Gi's total conversion hack) or to include it in every single track.

As for the other commands, I'm not sure yet. I don't know offhand of anything using F8 in FF6 successfully, so it's hard to know how important zeroing it at the start of a track is. (The only application I can think of for a whole-song filter effect is whitenoise SFX tracks? Maybe one of those uses it...) I'm not able to produce any NEGATIVE effects of zeroing it, so it may be better to include the F8 00 00 just in case. F0 and F2 need to be set, but that's not news. I did re-confirm that F4 does NOT need to be set; switching from a F4 20 song to a song without any F4 still played the second song at normal volume.

edit: like F4, F8 seems safe to ignore. Got a song nice and glitchy with it and it didn't corrupt later songs like F7 does.
  Find
Quote  
[-] The following 3 users say Thank You to emberling for this post:
  • Gi Nattak (07-19-2018), madsiur (07-19-2018), NPCnextdoor (07-18-2018)

#4
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
This is a incredibly good discovery! I have noticed the issue of the reverb bleeding into another song, mainly in RotDS's case when coming back inside the Returner Hideout from the Lethe River, which now makes total sense as the river track/song is one of the few original songs left in the hack so it has the F7 command, and uses a higher reverb setting so it was quite noticeable, but I just pretended like I was imagining it because I had a feeling it was something I could never hope to figure out lol. I also have noticed it when going through RotDS's music player, after selecting one of the original tracks, like one of the opera songs, then select a custom one... Going to axe those F7 commands pronto! Thank you!

Edit: This certainly isn't good for all the custom songs in the song data thread I've done that intentionally leave out said commands, is it lol... With MML song hacks, I -think- putting in the F7/F8 is okay, actually, as the glitchy track issue was originally for directly injected songs from similar sound engine games, like RS3, CT. I assumed this would be the case for any outside song data, including MML. SO, it seems I should have been including these commands (or at least F7) all this time to prevent this newly discovered issue.

It would be a massive task to update all the songs in the song data thread at this point, with the F7 command, and in-turn adjust all song pointers and song headers...damn.


We are born, live, die and then do the same thing over again.
Quote  

#5
Posts: 3,966
Threads: 279
Thanks Received: 233
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(07-19-2018, 01:11 PM)Gi Nattak Wrote: It would be a massive task to update all the songs in the song data thread at this point, with the F7 command, and in-turn adjust all song pointers and song headers...damn.

I thought channel pointers in song headers do not need an update when you modify a channel? or am I misunderstanding your statement?
  Find
Quote  

#6
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Ah oops I meant channel pointers, not song pointers >_<
As for your question though, the channel pointers in song headers would need to be adjusted if the length of the song changes, for instance if I was to attempt to put/splice in the F7 xx xx command, it would add +3 bytes and therefor would need the channel pointers adjusted by +3 as well.


We are born, live, die and then do the same thing over again.
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite