+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Custom Music in FFVI?
Pages: [1] 2 3
Author Topic: Custom Music in FFVI?  (Read 1 times)
Zeemis
Guest
« on: April 21, 2010, 04:08:19 pm »

I know it's possible, I have a hack on my desktop with FFIV music in it; however, I'd like to know how.
Would it be as simple as located the music in the rom and copy and pasting the "hex" of the custom song you want into where the default song is, which overwrites the default song?
Bond697
Guest
« Reply #1 on: April 21, 2010, 04:48:58 pm »

ask metroidquest, the ff6: the eternal crystals guy.

e: and here:

http://slickproductions.org/forum/index.php?topic=1227.0
Vehek
Guest
« Reply #2 on: April 21, 2010, 05:01:48 pm »

Quote from: Zeemis on April 21, 2010, 04:08:19 pm
Would it be as simple as located the music in the rom and copy and pasting the "hex" of the custom song you want into where the default song is, which overwrites the default song?
Almost correct. Assuming your music is in the music format FF6 uses, you also need to copy the data telling the game which instrument samples to load for the song. (This data is what JCE3000GT's SPC Sample Index Editor modifies.) Also, if your new song is bigger than the original, then you'll have to place it elsewhere and change the pointer to the song data.
Zeemis
Guest
« Reply #3 on: April 21, 2010, 05:04:53 pm »

Gotcha, and thanks guys.
I messaged MetroidQuest.
Bregalad
Guest
« Reply #4 on: April 22, 2010, 03:25:15 pm »

I reverse engineered the format for SNES squaresoft games long ago. There is basically 4 revisious of the engine, and the revision only affect the commands, not the note storage. FF6 uses the last one.
A byte $00-$D1 indicate a note. This is $0f * pitch + length.
Lenght is as follow :
$00 - whole note
$01 - dotted half note
$02 - half note
$03 - half note triplet
$04 - dotted quarter note
$05 - quarter note
$06 - quarter note triplet
$07 - dotted 8th note
$08 - 8th note
$09 - 8th note triplet
$0a - 16th note
$0b - 16th note triplet
$0c - 32nd note
$0d, $0e - ??

Pitch :
$00-$0e - C
$0f-$1d - Db
$1e-$2c - D
$2d-$3b - Eb
$3c-$4a - E
$4b-$59 - F
$5a-$68 - Gb
$69-$77 - G
$78-$86 - Ab
$87-$95 - A
$96-$a4 - Bb
$a5-$b3 - B
$b4-$c2 - Countinue previous note
$c3-$d1 - Rest

Bytes $d2 and above are commands. Commands are often followed by one or more bytes that are argument to commands. For the latest generation squaresoft games I don't have a full list of commands unfortunately, but I still have a good start :
$d6 + argument : Set octave #
$dc + argument : Set instrument #
$dd + argument : Set attack rate
$de + argument : Set decay rate
$df + argument : Set sustain level
$e0 + argument :Set sustain rate
$c4 + argument : Set volume
$cb + 3xargument : Tremolo Delay, speed, dept

If anyone wants the commands for older revision of the engine (FF4, FF5, SOM, etc...) just ask I have a full list of commands (wich is completely different).
Lenophis
Guest
« Reply #5 on: April 22, 2010, 03:41:07 pm »

Please. Grin Dunno how useful I'll find them, but you never know. :angel:
Zeemis
Guest
« Reply #6 on: April 22, 2010, 03:56:45 pm »

I asked MetroidQuest how he hacked in custom music. Well; rather, I kindly requested that he write up a small tutorial on what he did so I could teach my subscribers via YouTube. I stick by my philosophy that I document and teach what I've previously learned. Credit will be 100% given to him.

He replied:
Quote
You know, I've been debating whether or not to do that. I think I am warming up to the idea. Give me some time to compile something... and we'll discuss.

Best,

MQ
Bregalad
Guest
« Reply #7 on: April 22, 2010, 04:19:51 pm »

OK so here you are.

First revision (FF4) :
$d2 + 3Xargument : ?, ?, Tempo (first channel only)
$d4 + argument : Echo Volume (first channel only)
$d5 + 2Xargument : Echo Feedback, Echo Lenght (first channel only)
$d6 + 3Xargument : Slide pitch : ?, speed, nouvelle pitch
$d7 + 3Xargument : Slide volume, ?, speed, new volume
$d8 + 3Xargument : Vibrato delay, speed, dept
$d9 + argument : Panning LFO, ?, speed, deot
$da + argument : Set octave #
$db + argument : Set intrument #
$dc + argument : Set software envelopper #
$dd + argument : Sustain rate
$de + argument : related with note releasing faster before their end
$df + argument : Noise frequency.
$e0 + arument : Start repeat section, argument is #of repeats-1, 0 to repeat forever
$e1 : Increase octave
$e2 : Decrease octave
$e8 : Cancel vibrato
$ea : Echo on
$eb : Echo off
$ec : Noise on
$ed : Noise off
$ee : Pitch Modulation on
$ef : Pitch Modulation off
$f0 : End repeat section
$f1 : End track
$f2 + 3Xargument : ?, ?, Volume
$f3 + 3Xargument : ?, ?, Panning
$f4 : Loop track (Huh)

IMPORTANT : FF4 is a bit different from the others in a few aspects
1) Note lengths 3, 4 and 6, 7 are swapped as opposed to other versions.
2) "Rest" and "Continue note" commands are swapped
3) It uses software enveloppes instead of hardware ones which are defined in a table somewhere. I think FF4 uses values $00-$10, use $0d or $0b to have a "plain" enveloppe.
4) Voices $0x are for SFX, $4x are used for music. In other revisions, $0x is for SFX and $2x for music.

Revision 2 (Romancing SaGa) :
$d2 + argument : Set Tempo
$d3 : Restore "default" tempo
$d4 + argument : Set volume
$d5 + 2Xargument : Fade volume, speed, new volume
$d6 + argument : Set panning
$d7 + argument : Slide panning, speed, new pan
$d8 + argument : Echo Volume
$e1 : Noise frequency
$e2 : Noise On
$e3 : Noise Off
$e4 : Pitch Modulation On
$e5 : Pitch Modulation Off
$e6 + 2Xargument : Echo Feedback, echo delay
$e7 : Echo on
$e8 : Echo off
$eb + argument : Set octave #
$ec : Increase octave
$ed : Decrease octave
$f1 + 2Xargument : Loop, adress to jump
$f2 : Enable legato mode
$f3 + argument : Set instrument #
$f4 + argument : Set software enveloppe (?)
$f5 : Disable legato mode
$f7 + argument : Detune

3rd revision (Final Fantasy 5, Final Fantasy Mystic Quest, Secret of Mana, Hanjuku Hero) :
$d2 + argument : Set volume
$d3 + 2Xargument : Fade volume, speed, new volume
$d4 + argument : Set panning
$d5 + argument : Slide panning, speed, new panning
$d6 + 2Xargument : Slide pitch, speed, new pitch
$d7 + 3Xargument : Vibrato, delay, speed, dept
$d9 + 3Xargument : Tremolo (Volume LFO), delay, speed, dept
$db + 2Xargument : Panning LFO, speed, dept
$d8, $da, $dc : ?
$dd : Noise frequency
$de : Noise On
$df : Noise Off
$e0 : Pitch Modulation on
$e1 : Pitch Modulation off
$e2 : echo on
$e3 : echo off
$e4 + argument : Set octave #
$e5 : increase octave
$e6 : decrease octave
$e7 : Transpose (argument in semitones)
$e8 : Relative transpose (value here is added to previous transpose value)
$e9 : Detune ($10 is a semitone).
$ea + argument : Set instrument # (also set default envelope)
$eb + argument : Set attack rate
$ec + argument : Set decay rate
$ed + argument : Set sustain level
$ee + argument : Set sustain rate
$ef : Restore default envelope for selected instrument
$f0 + argument : Start repeating area, argument = # of repeats - 1, 0 to repeat forever
$f1 : End of repeat area
$f2 : End of track
$f3 + argument : Set tempo
$f4 + 2x argument : Accelerando/raletendo, speed, new tempo
$f5 : Do nothing
$f6 + argument : Do nothing
$f7 + argument : Do nothing
$f8 : ?
$f9 : ?
$fa : Loop (Huh)
$fe : End track
$ff : End track

4th revision (FF6, Live a Live, Romancing Saga 2, Romancing Saga 3, Chrono Trigger)
$d6 + argument : Set octave #
$dc + argument : Set instrument #
$dd + argument : Set attack rate
$de + argument : Set decay rate
$df + argument : Set sustain level
$e0 + argument :Set sustain rate
$c4 + argument : Set volume
$cb + 3xargument : Tremolo Delay, speed, dept

Note : How the loops works is kinda mysterious. In revision 1 and 2 it's simply the adress in SPC memory to jump to, but in others it seems to not work like that Sad
The amount of times you can nest repeat command without getting bugs depends on the revision. I think earlier revision only allow one repeat, but modern revisions allows more than that... more experiencing should be done.
Vehek
Guest
« Reply #8 on: April 22, 2010, 04:41:33 pm »

Quote from: Bregalad on April 22, 2010, 03:25:15 pm
There is basically 4 revisious of the engine, and the revision only affect the commands, not the note storage. FF6 uses the last one.
A byte $00-$D1 indicate a note. This is $0f * pitch + length.
Not quite correct. Your very own information about the commands contradicts that. The FF6 engine has its notes from $00-$C3. (The "dotted half note" is absent.)
Zeemis
Guest
« Reply #9 on: April 22, 2010, 07:31:47 pm »

I emailed Lord J about implementing an "Import Music" feature, his reply was (I mentioned MetroidQuests hack):

Quote
Yeah, I downloaded that hack, haven't given it a try yet.

As for FF3usME current dev is concerned, BRR samples imports are supported for .BRR and .SPC files, .WAV files is in the works.

It really works, I've done myself a little hack that takes instruments from Final Fight. It was really funny to hear when I tried the girl's scream for Shadow's theme Smiley

The only thing that isn't quite supported (and understood) are loop points (for BRRs that is, not SPCs), which made some of the track sound funny.

Well, that's a start. I've got all the offset for the rest of the SPC sitting in a folder. I've got some support to do, I hear that v6.6 gets crashy pointers with the Dialog Editor, sometimes. I just know for now that FF3Edit "corrupted WoR" ROMs can lead to that. I hope that's all there is to it...

Lord J


I'm not an incompetent idiot, but can someone rephrase that for me? I'm not sure I know what BRRs are. :x
Bregalad
Guest
« Reply #10 on: April 23, 2010, 06:13:21 am »

Quote from: Vehek on April 22, 2010, 04:41:33 pm

Not quite correct. Your very own information about the commands contradicts that. The FF6 engine has its notes from $00-$C3. (The "dotted half note" is absent.)
Thanks for pointing that out ! I haven't even noticed ! Like I said, I really took time to reverse engineer only the first 3 revisions, and not really the last (but just had a quick glance at it). Maybe there is even more revisions I'm not aware of.

So for real the notes are probably $0e*Pitch + Length for the fourth revision instead, which makes it incompatible with the 3 first revisions (altough first revision has some lenghts swaped, so only 2 and 3 are compatible).
JCE3000GT
Guest
« Reply #11 on: April 23, 2010, 05:30:27 pm »

Quote from: Zeemis on April 22, 2010, 07:31:47 pm
I emailed Lord J about implementing an "Import Music" feature, his reply was (I mentioned MetroidQuests hack):

Quote
Yeah, I downloaded that hack, haven't given it a try yet.

As for FF3usME current dev is concerned, BRR samples imports are supported for .BRR and .SPC files, .WAV files is in the works.

It really works, I've done myself a little hack that takes instruments from Final Fight. It was really funny to hear when I tried the girl's scream for Shadow's theme Smiley

The only thing that isn't quite supported (and understood) are loop points (for BRRs that is, not SPCs), which made some of the track sound funny.

Well, that's a start. I've got all the offset for the rest of the SPC sitting in a folder. I've got some support to do, I hear that v6.6 gets crashy pointers with the Dialog Editor, sometimes. I just know for now that FF3Edit "corrupted WoR" ROMs can lead to that. I hope that's all there is to it...

Lord J


I'm not an incompetent idiot, but can someone rephrase that for me? I'm not sure I know what BRRs are. :x

BRR  = bit rate reduction

Read here: clicky

I've toyed around with importing BRR's from one game to another with a mild amount of success.   Here are a few rough attempts.  I was trying to get the looping correct on the MQ distortion guitar and never finished.  Everything in the root folder are the BRR injections.  I'm in the process of creating a project that requires me to get back into working with SPCs so I might post some of my stuff later. 

http://www.jce3000gt.com/projects/audio

*edit*
Oh, and lets not forget that Mystic Quest's header is slightly different (by 1 byte) than FFV and Secret of Mana's but that they are completely interchangable.  Proof:

--> Scroll down towards the bottom

My favorites are the FFV imports to MQ.  Cheesy

moderator edit:
broken URL tag
« Last Edit: April 23, 2010, 06:53:52 pm by Lenophis »
Bregalad
Guest
« Reply #12 on: April 24, 2010, 03:44:51 am »

This is an amazing finding ! I love those songs with swapped instruments !

In case anyone have trouble converting between .wav <-> .brr feel free to use my BRR Tools it's open source freeware too so feel free to "steal" it.

EDIT : It seems the problem with importing the samples is their tuning, not their loops. I remember I was able to change the tuning of intruments in the early version of the music engine, it was defined somewhere close tho the default enveloppes if I remember well.
« Last Edit: April 24, 2010, 04:08:44 am by Bregalad »
Zeemis
Guest
« Reply #13 on: April 25, 2010, 01:46:40 am »

Call me me an imbecile, or call me incompetent; this is flat out difficult. >_>
http://www.youtube.com/watch?v=-AtO45F6twU
Vehek
Guest
« Reply #14 on: April 25, 2010, 01:55:52 am »

Can you specify where you copied from and what offsets you pasted to?
Pages: [1] 2 3  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC