øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1801.msg24008e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index8e04.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1801.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index8e04.html.zx-g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈÐH5OKtext/htmlISO-8859-1gzip(¾ÖH5ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 04:18:12 GMT0ó°° ®0®P®€§²ð®,g^ÿÿÿÿÿÿÿÿÖ2H5 Hacking the Music

Author Topic: Hacking the Music  (Read 4297 times)

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Hacking the Music
« on: January 16, 2013, 11:48:42 PM »
Hey y'all

I've spent the better part of the last month researching and experimenting with FFIV music hacking.
I don't know absolutely everything, but I certainly know enough.
I'm attaching a copy of the complete guide, but I'll paste the list of in-sequence commands below for easy access.
The song sequences begin at 3790E (ROM with header), and each song has an eighteen byte header preceding the command sequence.

Code: [Select]
Every command is listed below, in order, from 00 to FF. Commands have no parameters unless otherwise indicated.

Some commands have parameters, but no discernable effect (as far as I can tell). If a command is not listed
(such as E3), then it has no effect and no parameters.

In general, tracks also start off with their own header, which indicates information such as the relative
volume of the track, which instrument to use, how much reverb, etc. These track headers are commands that the
game treats no differently than notes and rests, and therefore the commands typically located in the track's
header can also be placed within the track to change effects mid-track. SPC data is read quickly enough that
the game will execute in-track commands without the music stopping or slowing down, so have fun!

TABLE OF NOTES, RESTS AND TIES

Commands 00 through D1 each represent a note, a rest, or an extension of a previous note or rest (a tie). When
deciding to use a tie, bear in mind that game music does not need to fit into a specific time signature, so
whereas a piece of sheet music may tie an eighth note at the end of one measure to an eighth note at the
beginning of the next measure, you can save one byte of space by simply using a quarter note. This is also the
practical application of the 3/4, 3/8 and 3/16 notes (which do not exist in standard music notation). Other
odd-fraction note durations (1/3, 1/6, 1/12, 1/24, 1/48) can be used when you want to play triplets. It takes a
bit of mathematical thinking. Three triplet quarter notes have the same duration as two regular quarter notes
(or one half note), so in order to play three triplet quarter notes, play three 1/6 notes.
(1/6 + 1/6 + 1/6 = 3/6, or 1/2)

Note Length C   C#  D   D#  E   F   F#  G   G#  A   A#  B   REST  TIE
----------- --  --  --  --  --  --  --  --  --  --  --  --  ----  ---
1/1 00  0F  1E  2D  3C  4B  5A  69  78  87  96  A5  B4    C3
3/4 01  10  1F  2E  3D  4C  5B  6A  79  88  97  A6  B5    C4
1/2 02  11  20  2F  3E  4D  5C  6B  7A  89  98  A7  B6    C5
3/8 03  12  21  30  3F  4E  5D  6C  7B  8A  99  A8  B7    C6
1/3 04  13  22  31  40  4F  5E  6D  7C  8B  9A  A9  B8    C7
1/4 05  14  23  32  41  50  5F  6E  7D  8C  9B  AA  B9    C8
3/16 06  15  24  33  42  51  60  6F  7E  8D  9C  AB  BA    C9
1/6 07  16  25  34  43  52  61  70  7F  8E  9D  AC  BB    CA
1/8 08  17  26  35  44  53  62  71  80  8F  9E  AD  BC    CB
1/12 09  18  27  36  45  54  63  72  81  90  9F  AE  BD    CC
1/16 0A  19  28  37  46  55  64  73  82  91  A0  AF  BE    CD
1/24 0B  1A  29  38  47  56  65  74  83  92  A1  B0  BF    CE
1/32 0C  1B  2A  39  48  57  66  75  84  93  A2  B1  C0    CF
1/48 0D  1C  2B  3A  49  58  67  76  85  94  A3  B2  C1    D0
1/64 0E  1D  2C  3B  4A  59  68  77  86  95  A4  B3  C2    D1

THE REST OF THE COMMANDS

D2: (+ 3 parameters, XX YY ZZ) Fade in tempo, where XX YY is the rate of fade, and ZZ is the tempo. Higher ZZ =
quicker tempo. XX YY are in reverse byte order, and higher value = slower fade. You will rarely if ever need to
set YY higher than 00.

D3: (+ 3 parameters) No discernable effect.

D4: (+ 1 parameter) Sets the "multiple voice" effect of a track, for lack of a better term. The higher the
value, the more it will seem like each note is being played on several keys (or instruments) simultaneously.
The effect is most significant with the organ, creating a difference between what sounds like an electric organ
(think "Come On, Baby Light My Fire" by The Doors), and a pipe organ (think church).

D5: (+ 2 parameters, XX YY) Reverb. The first parameter sets the reverb level (higher value = more echo). The
second parameter seems to set the reverb of the reverb. Be careful with this. Set a high YY in combination with
a high XX, and a single note will quickly turn into that sound the alien makes when the scientists try to
dissect it in Independence Day.

D6: (+ 3 parameters) A very funky reverb effect. Not very useful for composing music per se, but maybe useful
for implementing sound effects within music. The three parameters seem to work independently of one another
(they are three separate parameters, and not one or two multiple byte parameters). The higher their value, the
funkier the effect, but there seems to be a ceiling. I know, for example, that "35" has an effect, but "AA"
does not. "D6 0F 0F 0F" Has a fun, but again not really useful, effect. More experimentation is needed here,
but I don't really have the motivation to do so.

D7: (+ 3 parameters) No discernable effect.

D8: (+ 3 parameters) No discernable effect.

D9: (+ 3 parameters) No discernable effect.

DA: (+ 1 parameter) Set octave. 00 is the lowest.  I don't know how high it can go, but can't imagine you'd
need to go higher than 07 or 08.

DB: (+ 1 parameter) Set instrument, where "40" is the first instrument assigned to the song (in the index at
2420F), "41" is the second, and so on. Some weird stuff happens if you set an unassigned instrument. One higher
in value than the last instrument seems to be a quieter version of that instrument, two higher even quieter
than before, and so on in that fashion until you cannot hear the music at all. Several values lower than 40 (I
couldn't bear to experiment with exactly how many) will result in something that sounds like a buzzsaw playing
the notes you've written. Very grating and not recommended.

DC, DD: (+ 1 parameter each) I can't figure out what these do. According to jce3000gt, they are "set transpose"
and "increment transpose," respectively. In this particular instance I don't know what that means, and in my
experimentation, changing the value of these parameters has no effect.

DE: (+1 parameter) Set track volume. Near as I can tell, this is a RELATIVE volume value. If there is only one
track in the song, changing this value has no effect.

DF: (+ 1 parameter) No discernable effect.

E0/F0: Loop Start/End. E0 is inserted before the section to loop, with one parameter indicating the number of
times to loop. F0 is inserted at the end of the section to loop (no parameter). Interesting note - without an
"E0" at the beginning, F0 will simply play a sustained C (or, lowest note on the scale).

E1: Next octave up. All subsequent notes will be played in the octave above those preceding this command.

E2: Next octave down. All subsequent notes will be played in the octave below those preceding this command.

EB: Negates reverb setting for all subsequent notes.

EC: Makes all subsequent notes sound like static instead of notes.

F0: (SEE E0)

F1: Stops the music.

F2: (+ 3 parameters, XX YY ZZ) Volume. Only ZZ seems to have any effect, and it looks like XX YY is always 00
00 in the game's original programming.

F3: (+3 parameters, XX YY ZZ) I don't know what this does. It must have some effect, because in the original
programming, every song has an F3 command in the beginning. Seems XX and YY have no effect, because they're
always 00 00. ZZ ranges from about 50 to C0, and is most commonly in the 80s.

F4: (+ 2 parameters) This is the "go to" command. Placing this command at the end of every track is how the
game loops music indefinitely. Remember, as before, to start counting with 00 20 (reverse byte order), and to
count from the song's byte #02, not byte #00.

F5: (+ 3 parameters) No discernable effect.

F6 and above: Stops the music.

btw - credit where credit is due: this work was started by jce3000gt and the rest of the contributors on this thread:
http://slickproductions.org/forum/index.php?topic=163.0

Hope this info helps some of you do some fun stuff!
« Last Edit: January 23, 2016, 09:43:32 AM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Hacking the Music
« Reply #1 on: January 17, 2013, 11:44:02 AM »
Very impressive! Glad to see you're still around Chillyfeez, music was unfortunately never my forte, but I'm sure others will be able to use these notes to great effect!

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,429
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Hacking the Music
« Reply #2 on: January 17, 2013, 01:37:47 PM »
Love it!  Great work.  Glad I was able to help. :)

Now if I could get someone to compose a song or two from another game for my latest FFIV hack I'd be happy. 

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Hacking the Music
« Reply #3 on: January 17, 2013, 03:59:03 PM »
Very impressive! Glad to see you're still around Chillyfeez
I never REALLY left. In the real world, my job is retail management, so I don't get a lot of free time in Nov/Dec. I'm still working slowly but surely on my big project. Learning about the game's SPC engine was part of it.

Now if I could get someone to compose a song or two from another game for my latest FFIV hack I'd be happy. 
Do you mean existing game songs? If I could find the midis, I'd do it for you. It would be good practice.

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,429
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Hacking the Music
« Reply #4 on: January 17, 2013, 06:49:13 PM »
Actually I have a couple of MIDIs and possibly existing game SPCs I'd like to have someone compose.  I am swamped with doing the graphics, AI, maps, and etc.  :(

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Hacking the Music
« Reply #5 on: January 17, 2013, 10:02:38 PM »
Well, if you wanna send me one to work on, I just turned on "allow users to email me." I won't make any promises about how quickly I'll get it done, but I won't leave you hanging.

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,429
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Hacking the Music
« Reply #6 on: January 18, 2013, 03:24:51 PM »
Well, if you wanna send me one to work on, I just turned on "allow users to email me." I won't make any promises about how quickly I'll get it done, but I won't leave you hanging.

Cool, no worries. Have a while before I'm done with it. I will get back to you this weekend hopefully. Thx for the help.  :)
« Last Edit: January 18, 2013, 03:31:16 PM by JCE3000GT »

TheNattak

  • Garula
  • *
  • Posts: 203
  • Gender: Male
  • Mike
    • View Profile
    • Return of the Dark Sorcerer
Re: Hacking the Music
« Reply #7 on: January 29, 2013, 11:10:31 PM »
"D4: (+ 1 parameter) Sets the "multiple voice" effect of a track, for lack of a better term. The higher the
value, the more it will seem like each note is being played on several keys (or instruments) simultaneously.
The effect is most significant with the organ, creating a difference between what sounds like an electric organ
(think "Come On, Baby Light My Fire" by The Doors), and a pipe organ (think church)."

Hm, this must be the same as the F4 XX command in FFVI...? I've always wondered what it does exactly. I'm not entirely sure I grasp you definition of it though, are you saying it allows a track to play over other channels and/or instruments?

All I know is that most songs that include it seem to have it in just one track usually, and when I use it in my custom songs it seems to make the song as a whole quieter usually, especially if I use it more than once, which leads me to think I'm using it incorrectly. I've been throwing it around on things like string sections, and as you mentioned here, organs - basically instruments that have drawn-out lengths.

Might you happen to know anything further about this command, like when and how it should be used for the best effect/result? And when to not bother using it at all. Also, does channel pan have any influence over it?
« Last Edit: January 29, 2013, 11:24:12 PM by TheNattak »

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Hacking the Music
« Reply #8 on: January 30, 2013, 12:05:30 AM »
It's pretty difficult to describe with words... I suggest trying a single track with a few whole notes and a high D4, then change the D4 to 00. You will definitely notice a difference, especially with instruments that have a sustainable voice.

As far as I can tell, it only affects the timbre/quality of the instrument, and not how the track cooperates with others - but to be honest, I'm not sure I even tested it with multiple tracks. If you find that it has other effects than what I found, I'll update the guide. I've already found a few minor changes I need to make since I posted it.

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: Hacking the Music
« Reply #9 on: August 19, 2015, 04:17:26 PM »
I don't mean to necropost (though I figure this would be better than starting a new thread), but would anyone happen to still have Chillyfeez's Complete Music Hacking Guide.txt?  It was lost during the forum's downtime, and I'd like to take a gander a it.
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Hacking the Music
« Reply #10 on: August 19, 2015, 07:27:10 PM »
This person does!

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: Hacking the Music
« Reply #11 on: August 20, 2015, 12:59:39 PM »
Awesome! Thanks, Chillyfeez!


So far I've read up to instruments portion of the guide,  and am currently playing around testing the instruments out using the title screen music. Very entertaining stuff.  I think I might do this with a number of songs I intend to keep that are starting to get on my nerves. and try my hand at creating some new stuff using one of the number of tracks I'm either not using or don't care about (and so far I've got good few in that catagory, including the Black Chocobo Music).

I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Hacking the Music
« Reply #12 on: August 20, 2015, 01:10:40 PM »
Cool.
Writing new music into the game is extraordinarily tedious work, but it's pretty rewarding when you get one done.

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Re: Hacking the Music
« Reply #13 on: August 20, 2015, 05:34:56 PM »
Yeah, it sounds like it would be by what I'm reading. I'm going to take your advice and make a simple melody to start out with, and see how it goes from there.

Until then, I'll be instrument swapping the vanilla tracks.  Changing "Dwarf Castle"'s trumpet to bowed strings makes it sound like it would right in with Chrono Trigger. Ilove it,
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Hacking the Music
« Reply #14 on: January 23, 2016, 01:03:38 PM »
Pinkpuff wrote me recently to inquire about looping "Ending 3" (the end credit sequence music).
I started waxing philosophical about exactly how to go about doing it in my reply, but thenI got to thinking: I just composed an entire original piece for my own hack, so my skills on this one are already sharpened - a couple hours' work for me vs however long it might take someone else to get the hang of the extremely un-intuitive SPC system...
So I just went ahead and did it.
This patch will make the Ending 3 music loop back to just after the intro instead of playing the coda and ending.
It doesn't use any free space, so it should patch cleanly into any ROM. Unheadered. 1.0 or 1.1 will work.
:)