ff3:ff3us:tutorial:music:songdata

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ff3:ff3us:tutorial:music:songdata [2018/04/22 21:28]
lockirby2 Not done yet.
ff3:ff3us:tutorial:music:songdata [2019/02/12 12:05] (current)
Line 3: Line 3:
  
 ==== 1. Getting the file and tool ==== ==== 1. Getting the file and tool ====
-We'll be using the FFIV song [[https://www.ff6hacking.com/misc/songsdata/FF4_prologue.7z|"The Prologue"]] from our [[https://www.ff6hacking.com/forums/thread-2558.html|Song Database]]. The other thing you will need is a hex editor. There are many you can choose from, but I'd suggest one that has copy selection, paste-write, and paste-insert functionalities. One good all purpose hex editor is {{rh:util:hex:hxd_1.7.7.0.zip|HxD}}, and this is what has been used to take the screenshots below.+We'll be using the FFIV song [[https://www.ff6hacking.com/misc/songsdata/FF4_prologue.7z|"The Prologue"]] from our [[https://www.ff6hacking.com/forums/thread-2558.html|Song Database]]. The other thing you will need is a hex editor. There are many you can choose from, but I'd suggest one that has copy selection, paste-write, and paste-insert functionalities. One good all-purpose hex editor is {{rh:util:hex:hxd_1.7.7.0.zip|HxD}}, and this is what has been used to take the screenshots below.
  
 ==== 2. Files we will be importing ==== ==== 2. Files we will be importing ====
Line 49: Line 49:
 {{ff3:ff3us:tutorial:music:songdata:sd-calcl-room.png}} {{ff3:ff3us:tutorial:music:songdata:sd-calcl-room.png}}
  
-We are below the limit with our 0x044C bytes for //The Prelude//, so we are ready to insert the song!+We are below the $0x04CC byte limit because //The Prelude// is only $0x044C bytes long, so we are ready to insert the song!
  
 ==== 5. Copying the song data ==== ==== 5. Copying the song data ====
-Copy all the content of //prelude_DATA.bin// (//Ctrl+C//go to your ROM do //Ctrl+G// and enter //"08EFA6"//. You'll land on the offset you need to paste the song data (//Right-click->Paste-write//). The below two screenshots are the beginning and ed of the song pasted.+ 
 +Now copy the song data to your ROM. 
 + 
 +  - Select and copy the content of //prelude_DATA.bin// (//Ctrl+C//) 
 +  - In your ROM file, press //Ctrl+G// and enter //"08EFA6"// to reach the offset where I decided to paste the song data
 +  - //Right-click -> Paste-write//. The two screenshots below are the beginning and end of the song pasted.
  
 {{ff3:ff3us:tutorial:music:songdata:sd-song-paste-start.png}} {{ff3:ff3us:tutorial:music:songdata:sd-song-paste-ending.png}} {{ff3:ff3us:tutorial:music:songdata:sd-song-paste-start.png}} {{ff3:ff3us:tutorial:music:songdata:sd-song-paste-ending.png}}
  
-You can optionally put //00// or //FF// at the place of the rest of the old songThis way you can easily see where there is unused space.+Optionally, you can overwrite the rest of the old song with //00// or //FF//That wayyou can easily see where there is unused space.
  
 {{ff3:ff3us:tutorial:music:songdata:sd-song-paste-zero.png}} {{ff3:ff3us:tutorial:music:songdata:sd-song-paste-zero.png}}
  
 ==== 6. Changing the song pointer ==== ==== 6. Changing the song pointer ====
-If you have to put your song elsewhere in the ROM, you need to modify the pointer and you can calculate its position will the below formula. It's simply pointers base offset + (song ID multiplied by 3). The other method is doing a hex search in HxD with the old offset of the song. In the case of as an example $C8EFA6, search for //A6EFC8//.+If you have to put your song elsewhere in the ROM, you need to modify the pointer. You can calculate its position with the formula below: 
 + 
 +<Pointer Block Base Offset> + (<Song ID> * 3). 
 + 
 +You can also do a hex search in HxD with the old offset of the song. For example, if the old offset of the song is $C8EFA6 (as with //"Another World of Beasts"//), search for //A6EFC8//
 + 
 +After locating the pointer, change it to the new offset of the song (inverted).
  
 {{ff3:ff3us:tutorial:music:songdata:sd-calc-ptr.png}} {{ff3:ff3us:tutorial:music:songdata:sd-calc-ptr.png}}
Line 68: Line 79:
  
 ==== 7. Changing the instruments ==== ==== 7. Changing the instruments ====
-Now the other part of the job is changing the song channels instruments. It's the same logic to calculate the beginning of a song instruments, except you multiply your song ID by 32 (0x20). The instruments file is 32 bytes in size (16 channels times 2 bytes per instruments). First byte is instrument ID, second byte is always 00.+Now the other part of the job is changing the song channelsinstruments. It's the same logic as calculating the offset of a song pointer, except that you multiply your song ID by 32 (0x20). The instruments file is 32 bytes in size (16 channels times 2 bytes per instrument). The first byte for each channel is the instrument ID, while the second byte is always 00.
  
 {{ff3:ff3us:tutorial:music:songdata:sd-calc-inst.png}} {{ff3:ff3us:tutorial:music:songdata:sd-calc-inst.png}}
  
-Once the instruments data is pasted, save your ROM. Note that you can save (//Ctrl+S//) anytime during the tutorialit does not matter.+Once the instrument data is pasted, save your ROM. Note that you can save (//Ctrl+S//) anytime during the tutorialit does not matter.
  
 {{ff3:ff3us:tutorial:music:songdata:sd-instrument-paste.png}} {{ff3:ff3us:tutorial:music:songdata:sd-instrument-paste.png}}
  
-You'll notice //The Prelude// has 6 instruments. As mentioned previously some songs downloaded from the forum (not a majority) might have incorrect instruments. In such an event, you'll need to assign the correct instruments. There is a complete list of original instruments [[ff3:ff3us:doc:asm:list:instruments|here]]. You'll need to identify each channel instrument and replace what you think are the wrong onesbit trial and error but you'll develop your music skills. If you have instruments IDs in your file from $40 and above it mean your song require the instrument patch available in the same thread as the songs. The songs requiring will have a "ᵖ" next to their name. The wrong assigned instruments are often those, because the author added more instruments in his hack without noticing the admins, resulting in instrument indexes above the limit of the patch.+You'll notice that //The Prelude// has 6 instruments. As mentioned previouslysome songs downloaded from the forum (not a majority) might have incorrect instruments. In such an event, you'll need to assign the correct instruments. There is a complete list of original instruments [[ff3:ff3us:doc:asm:list:instruments|here]]. You'll need to identify each channel'instrument and replace the ones you think are wrong. This requires a bit of trial and errorbut you'll develop your music skills. If you have instruments IDs in your file that are $40 and aboveit means that your song requires the instrument patch available in the same thread as the song. The songs requiring this will have a "ᵖ" next to their name. These songs often have incorrectly assigned instruments as well because the authors sometimes add more instruments to their hacks without notifying the admins, resulting in instrument indexes above the limits of the patch.
    
 {{ff3:ff3us:tutorial:music:songdata:sd-instrument-new.png}} {{ff3:ff3us:tutorial:music:songdata:sd-instrument-new.png}}
  
 ==== 8. Details on song channels ==== ==== 8. Details on song channels ====
-thing that differs between songs available on the forum and original songs are the channel pointers in the song. Below is a channel of //The Prelude// and the song at the end loop toward the beginning of the blue section. The last command is //F6 02 04// which mean continue by going back to 0x0402 byte after the start of the song. Every song in the original game have these command relative to their offset in the ROM meaning this F6 command would look like as //F6 8E F3// ($C8F38E). It would not be exactly this because a song don't redo the first channel commands twice but I talk about this because such a tutorial would not have been possible with an unmodified original song, because when you move it you need to change all the song loop commands and channel pointers at beginning of song data. By having the custom song channel pointers start at 00 00 and not the song offset last two bytes, we easy the process a lot.+One thing that differs between songs available on the forum and original songs are the channel pointers in the song. The image below shows a channel of //The Prelude//. The song loops from the end of the highlighted section to its beginning. The last command is //F6 02 04//which loops the song by going back to the offset that is 0x0402 bytes after the start of the song. For every song in the original gamethese commands are relative to their offset in the ROM, so this F6 command would look similar to //F6 8E F3// ($C8F38E) insteadHowever, it would not be exactly this because a song don't redo the first channel commandswanted to talk about this because such a tutorial would not have been possible with an unmodified original song. If you moved or inserted a song, you would have needed to change every song loop command and channel pointer! By having the custom song channel pointers start at 00 00 and not the song offset'last two bytes, we make the process a lot easier.
  
 {{ff3:ff3us:tutorial:music:songdata:sd-channel.png}} {{ff3:ff3us:tutorial:music:songdata:sd-channel.png}}
  
-Below, a loop command of an original song pointing at $C8F9B9. In the case of a custom song, we would see more or less F6 0X XX, likely a number below 0x0A00.+Below, there is a loop command of an original song pointing to $C8F9B9. In the case of a custom song, this command would be something like F6 0X XX instead, likely a number below 0x0A00.
  
 {{ff3:ff3us:tutorial:music:songdata:sd-channel-loop.png}} {{ff3:ff3us:tutorial:music:songdata:sd-channel-loop.png}}
Line 91: Line 102:
 ==== 9. Conclusion ==== ==== 9. Conclusion ====
  
-This tutorial was aimed at beginners. The rest of music hacking is harder and require some practice. However it is in the range of anyone having the time and patience to learn. As a conclusion I've made a small video showing the import and at the same time did a little tribute to those who contributed to the song database.+This tutorial was aimed at beginners. The rest of music hacking is harder and require some practice. Howeverit is within the abilities of anyone who has the time and patience to learn. To serve as a conclusionI've made a small video that shows the import and simultaneously pays a little tribute to those who contributed to the song database.
  
 ==== 10. Result in-game ==== ==== 10. Result in-game ====
 {{ff3:ff3us:tutorial:music:songdata:sd-result.mp4?384x336}} {{ff3:ff3us:tutorial:music:songdata:sd-result.mp4?384x336}}
  • ff3/ff3us/tutorial/music/songdata.1524432501.txt.gz
  • Last modified: 5 years ago
  • (external edit)