Are there any Namco-163 hacks out there?

Started by Ben Boldt, May 14, 2016, 12:00:24 PM

Previous topic - Next topic

Ben Boldt

Sorry for the long delay on this.  I have been working on the "opening theme", which is the music that plays when you cross the bridge.  This song is very difficult because it has many layers that keep changing, and it also has many small & fast notes and chords in it sprinkled everywhere.  Also because I am not a musician by any means.

I have been working on getting the notes figured out and I wanted to share a progress report.  This is the score so far, played by Apple Logic in slow motion.  The end of this song is still not complete, and there are some things missing from the middle.  I will eventually get this done!


Very impressive!!! Tugged my heart in fact  :angel:

I did a quick calculation this morning and I've changed/altered nearly 1/3 of the game's total text in the most recent version of Reconstructed, not to mention I actually believe every single location tile now (open beta 2 will be out within the next week, and hopefully next few days) So I've been hard at work developing the narrative you had suggested. I'm super impressed with the quality the sound engine is capable of.
You're a fine composer buddy, keep on keepin on (and please don't mind a question from time to time next month when I move to sound)
:thumbsup:  :beer:
Tell my tale to those who ask. Tell it truly, the ill deeds along with the good, and let me be judged accordingly. The rest... is silence...

Ben Boldt

I have an update!  The opening theme is pretty much done, I am very happy with it:

I am sorry this took so long.  I couldn't get into the right zone for this one.  But I have just returned from a 2 week trip to China.  Maybe I have just the right combination of jet lag and happy to be home that made this finally work.

Anyway, I ran into a problem.  I wrote this one as "song 1" where the prelude normally plays when you start the game.  This just made it easy for me to always start from the beginning by hitting reset.  That all went fine, and that is one of the files I attached.  But when I move this over to the actual "song 2" when you cross the bridge, it just plays the first few notes and then the music locks up.  It appears that the music locks up coinciding with the transition visual effect, but I'm not sure.  Is there any way you could download this and have a look Disch?

Here are the files:

Ben Boldt

Time for something easier!  I am working on the shop music now.

Here is the slow Apple Logic version, which I am using to enter the notes into the actual game:


I got it into the ROM now!

Audio recording form Nestopia:


Ben Boldt


I started working on the ship music!  I have gotten part of it into Logic:

In fact, I happened upon some free LCDs and upgraded my Power Mac G5 from 1 monitor to 3 monitors and this is WAY easier to juggle windows for this stuff now.

Here is the rundown of tracks left to do (+ means done):

+ 1. Prelude
+ 2. Opening Theme
  3. Ending Theme
+ 4. World
  5. Ship
  6. Airship
+ 7. Town
+ 8. Coneria Castle
+ 9. Gurgu Volcano
  10. Matoya's Cave
  11. Dungeon
+ 12. Chaos' Temple
  13. Floating Castle
  14. Future Chaos' Temple
+ 15. Shop
+ 16. Battle
+ 17. Menu Screen
+ 18. Death
+ 19. Victory
+ 20. Got important item
+ 21. Got treasure Chest
  22. Saved
+ 23. Character Order Screen


I got the ship music done now.


Ship Music on actual ship (percussion wiped out by water sound effect...):

Ship Music with percussion as intended:


Quote from: Ben Boldt on October 22, 2017, 02:28:26 AM
Finally an update!

Matoya's Theme is done now.


Ever since I found this project (which admittedly was only about a week ago), I've been looking forward to seeing what you do for Matoya's Cave, since it's my absolute favorite bit of 8-bit game music.

From what I saw in that video you did a good job.

Quick question though... What emulator do I need to run that ROM with the the enhanced audio? Hasn't loaded up in any of the ones I've tried so far (which admittedly is only higan...).

And lastly, Any chance of a .wav (or midi, if it's more appropriate) of your enhanced version of Matoya's cave?

Ben Boldt

I am glad you like it edale.  I use FCEUX and Nestopia no problem, and I have also run this on an actual Namco-163 chip with no problem.

Nestopia and FCEUX have good but not perfect emulation of Namco-163 audio.  On real hardware, if you look at the waveform coming out of the Nintendo, it stays very nicely centered, but when I look at the waveform put out by Nestopia, it is upside down and always wants to shift positive and drift back to center.  Also, there are extra clicks and pops in the emulator when starting and stopping notes that that do not exist on the real hardware.  This can be easily heard in the harp when first starting the game the game.  Lastly, both emulators limit my sound wave shape to 32 samples.  It appears that I can use all 192 samples for a single wave shape on the real hardware, which would allow for higher fidelity sound.

I don't think I'm 100% done with this song yet.  There are some parts that I have not fine-tuned yet.  I would like to balance it better and add more expression.  Overall, this song is quite loud, so I may try to quiet it down (which is way easier said than done actually).  If you want a perfect recording of anything from this hack, get FCEUX, choose File -> AVI/Wav -> Record WAV... and this will create the lossless file(s) you are looking for!


So I tried finding a save file for FF1 NES close to Matoya's Cave, so I wouldn't have to play through the whole beginning section of the game to get there.

Turns out the save files aren't compatible anymore, BUT I got a save-state to load... with LOTS of graphical glitching, that completely fixed itself when I entered/exited the town, lol.

For that 32 vs 128 sample thing, have you posted about it to the FCEUX bug report/feature request forum? Or made any other attempts at getting that fixed?

Oh, and about how long is the loop for Matoya's cave? Will make cleaning up my recording easier.

*edit- OK, there was actually a few samples of silence between each chunk of music, this made it VERY easy finding the exact loop point.

Here's a WAV of this version of Matoya's Cave, encoded to (Microsoft) 16-bit signed PCM.!qZImAJKa!B9C6PU3vAaY2iwdfYH41rw1KO-XNtEJIbPjOVsI-5EY

ATM the only way I know to make a music loop in the actual file is with MSU-1 compatible PCM audio, which isn't really playable outside of an MSU-1 hacked SNES game and the proper emulator (without a plugin qwertymodo made for Foobar, that's kinda hard to find unless you ask him for it, or importing raw data in Audacity); but this track is a perfect loop if you loop the very last sample to sample 1 (not sample 0, 1 sample in from the start, I know looping to sample 0 can cause problems for some playback devices/encoders).

Or you could just set your player to auto-repeat.

Ben Boldt

That is very cool edale!  It makes me feel bad that I had not polished this song better before you did this.  I am amazed that you were able to get a save state to work with this hack.  I had a similar problem getting to Matoya's cave and I actually played the game to get there, which took a long time.  I used a couple of Game Genie codes, and that made it easier.

If you would like to do this with other songs more easily, you can change the song that plays when you first start the game to any other song.  You want to change the byte in the ROM file at address 0x3A236. Value 0x41 (default) = song #1.  0x42 = song #2.  etc.  Songs that I have not implemented yet will just play silent.

You can also do this directly with FCEUX's Game Genie Encoder instead of a hex editor.  You can do it like this:

Use address A226, compare 41, and value to be your new value larger than 41 for different songs.  Then just click "Add to Cheat List".  Then if you want to try a different song, go into Tools -> Cheats and either delete the code there and start over, or update the code directly in that window.


I used these gamesaves:
They have both the save file and savestates, like I said the save files were useless, but the savestate did load, with lots of glitching. I used save #2, and the saves are right outside the town (that you can't see because of the glitching, but it's there), just had to go up a space or two to enter the town, and everything fixed itself. Then I just had to walk back to get to Matoya's Cave.

Note, It wouldn't load when it was just named properly, and I hit the load savestate button, I had to File>Savestate>"load savestate from" and point it to the savestate file to get it to load.

I made that wav for myself (like I said, it's my favorite 8-bit music track), and just decided to share. My music editing skills have gotten quite the improvement recently, since I've been helping with the audio for the Dancing Mad MSU-1 mod for Final Fantasy VI ( - quite the similar project to this one, though much easier technically, I can just convert a pre-existing track to the right format), so this was quite simple to do in comparison.

I don't mind making recordings of all your enhanced tracks if you want me to, and can easily remake the matoya's cave one if/when you clean it up more (actually, you'd be hard-pressed to stop me, lol).

A list of the values for that gamegenie code that matches your tracks would be helpful, so I don't have to trial-and-error the values out.

Edit- Are these the values, or is it +1 to all of them?
41. Prelude
42. Opening Theme
44. World
47. Town
48. Coneria Castle
49. Gurgu Volcano
50. Matoya's Cave
52. Chaos' Temple
55. Shop
56. Battle
57. Menu Screen
58. Death
59. Victory
50. Got important item
51. Got treasure Chest
53. Character Order Screen

Oh, and your Matoya's Cave is my current ringtone.  :thumbsup:

Ben Boldt

Here are the Game Genie codes for each possible song.  A '+' means the song has been written, missing a plus means the song is missing.  These codes work on the original Final Fantasy unmodified, and also the Namco-163 version.

+ ZGXZTZPG Start game with music track "Opening Theme"
  LGXZTZPG Start game with music track "Ending Theme"
+ GGXZTZPG Start game with music track "World"
+ IGXZTZPG Start game with music track "Ship"
  TGXZTZPG Start game with music track "Airship"
+ YGXZTZPG Start game with music track "Town"
+ AGXZTZPK Start game with music track "Coneria Castle"
+ PGXZTZPK Start game with music track "Gurgu Volcano"
+ ZGXZTZPK Start game with music track "Matoya's Cave"
  LGXZTZPK Start game with music track "Dungeon"
+ GGXZTZPK Start game with music track "Chaos' Temple"
  IGXZTZPK Start game with music track "Floating Castle"
  TGXZTZPK Start game with music track "Future Chaos' Temple"
+ YGXZTZPK Start game with music track "Shop"
+ AIXZTZPG Start game with music track "Battle"
+ PIXZTZPG Start game with music track "Menu Screen"
+ ZIXZTZPG Start game with music track "Death"
+ LIXZTZPG Start game with music track "Victory"
+ GIXZTZPG Start game with music track "Got Special Item"
+ IIXZTZPG Start game with music track "Prelude (Character rearrangement version)"
  TIXZTZPG Start game with music track "Save"
  YIXZTZPG Start game with music track "Potion"
+ AIXZTZPK Start game with music track "Treasure Chest"


Every track that you've completed so far.

Not all the songs can loop nicely back to the start, some have intros, and 2 of the tracks don't loop at all. So each rar also has a txt file with the loop point.

I'll use the Ship track as an example, it's loop point is at sample 132,114. So if you import the wav to Audacity, change the settings at the bottom of the interface to "samples", select all, then manually type 000132114 into the "selection start" field, hold shift and click play... It will play the entire loop over and over (without the intro).

Again, I don't know how to make properly looping audio files, so these are just wav's (44100 Hz,
Microsoft 16-bit signed PCM).

Ben Boldt

Nice job Edale!  With the ship music, the game originally played the "waves" sound asynchronous to the music, so when I tried playing snare drum with the noise channel, it got overwritten by the waves, and it didn't really work.  So I had made one of the pulse channels imitate the snare drum I wanted to play.

Later I found out how to disable the waves, which made my snare drum work again, and I left the pulse in there, it sound kind of cool.  It uses the animated duty cycle feature to sound kind of bubbly.  However, I used up 2 or 3 of my precious envelopes for this.

Since the snare drum only plays during part of the song, I plan to recreate the wave effect, hard-coded into the music, then stop it when the snare drum part comes.  I also plan to try to remove the extra envelopes I used and do something that sounds similar with my existing envelopes.

Also, I have NEVER been happy with my version of the Gurgu Volcano.  It is way too soft and relaxed.  It definitely has the gloppy qualities of lava squishing around but I need some more bass and sparks and fire and I'm not sure how to do that.

I mentioned that I would like to refine Matoya's cave a little more.  I'm not sure about that one now, it might be hard to improve it much with my existing methods.

So I think you can expect some changes to the ship and gurgu volcano eventually.  The other ones are looking pretty stable.


Whelp, when you release a patch with a new/redone track, I can remake the wav file. Can't do much until then. ;)

November 14, 2017, 02:04:43 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

I was looking into how to rip the music from an NES rom. Apparently it's a LOT more complex than doing such for something like the SNES.

NSF files (NES native soundtrack files, contains soundtrack for the entire game, not just 1 track) are apparently the actual game ROM stripped of everything but the music engine and the track data.

The absolute hardest part of making one? Tracking down the exact locations of the music engine, and the track data.

I didn't get to deep into how to make one, it quickly got quite a bit over my head, but if I understood things correctly, if the exact addresses of both the music engine and the track data are known, it's a relatively simple process to make the actual NSF file.

This wouldn't be something I'd consider trying to do now, but once you're completely done with the game?

Needless to say, I'm hoping you've documented everything in such a way that you already know the hex locations of everything a NSF file would need.

No big deal if not though.

Ben Boldt

Hi edale,

Update to the ship music, it contains the water wave sound effects now!

In the original game, the water waves sound effect was produced separately from the music score.  This made the water have a pseudo-random placement in time with respect the music score.  When I rewrote this for Namco-163, I used the noise channel for a snare drum in the second half of the song.  However, you could not hear it because the wave sound effect interfered.  The waves were written to the noise channel control registers so often that very little could get through from the music score.

I figured out how to disable the wave effect and hard-coded my own wave effect into the music score.  This way I can stop the waves when it is time for me to play the snare drum.  I think it turned out pretty good!  The original waves used a fixed frequency band on the noise channel.  I am now shifting around the frequency band for a more choppy / breaking through waves effect.



I do have info about the sound engine, mostly provided by Disch who originally put this together.  I have mostly been writing music scores/wave shapes/envelopes/etc, with some small hacking here and there as needed.  I know that the sound engine starts at ROM file address 0x3C010 (which is Page 0x0F, address 0x8000 in the Namco-163 memory mapping).  You can search for this data signature:

A5 4B 30 5C F0 0C

which disassembles to:
A5 4B = LDA 0x004B ;Load the contents of RAM address 4B into the accumulator
30 5C = BMI 0x8060 ;If bit 7 is set in the accumulator (i.e. 'MInus' or negative), branch to address 0x8060
F0 0C = BEQ 0x8009 ;If the accumulator EQuals 0x00, branch to 0x8009

The Nintendo runs the music engine with a JSR to 0x3C010.  This gets called each VBlank.  I am not familiar with how NSF works, but it is a safe bet to get the Vblank connected to this point of the code somehow.

RAM address 0x004B contains the number starting at 0x41 that you played around with earlier.  I think it is a matter of putting the correct number into 0x004B, getting the sound engine to initialize and start, and calling that function at 0x3C010.  In fact, the '4' in 41 may serve as a bitfield with the 'initialize/start' bit set!  I am not sure on that but it seems like an idea consistent with the approach of checking bit 7 as seen above.

It might be a lot easier said than done though.  I really have no clue because I have never made an NSF before.  As we get farther along, we can figure out how to do NSF.  For now we at least have the Game Genie codes to get by with.


Old ship song renamed to ff_namcot_ship_v1, and added the new ff_namcot_ship_v2.!nN53URiA!wtj-5Lfg0V1kxckTVCYDaA
And your Youtube link doesn't work. "Video is unavailable" message.

Ben Boldt

I fixed the youtube link now.

November 19, 2017, 01:10:24 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

Do you have any recommendation for which song I should do next?


Quote from: Ben Boldt on November 16, 2017, 09:01:41 PMDo you have any recommendation for which song I should do next?
It seemed you were doing the songs mostly in the order you come across them in-game, wouldn't that put "Dungeon" as the next track?

Or you could do "save" and "potion" and get all the short 10 sec or less clips out of the way.

Ben Boldt

I have made improvements to Matoya's Cave:
- Increased bass by lowering pulse channel 1 by 1 octave and choosing a louder envelope, also reflecting some notes from Namcot channel 1
- Decreased volume of the lower flute (Namcot channel 3) by choosing a quieter envelope
- Added more dynamics to the lead instrument (Namcot channel 0) by using a larger variety of envelopes, and also creating 2 new envelopes, #23 and #24

Also, I got Potion done and I added a small improvised part to the menu music to make it less repetitive.  I have not yet done Save or Dungeon.