Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: Ben Boldt on May 14, 2016, 12:00:24 pm

Title: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 14, 2016, 12:00:24 pm
Has anyone ever seen a hack that utilizes Namco-163 expansion audio?  As much as I search, I have never found such a hack.  I have found quite a few famitracker tunes that are super cool versions of music from games, but I have never seen these inserted into an actual ROM and playable.

I understand that there are 2 obstacles with this:
1.  Make the game's memory mapping work on Namco-163
2.  Change the game's music engine to support Namco-163 expansion audio

Has nobody ever done this successfully?  I think we could open some doors to different sorts of audio hacks if we had at least one example, even if it's a simple one, for example starting from a mapper 0 game to minimize #1 above.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 14, 2016, 01:45:33 pm
I did this for someone else's Final Fantasy hack that has yet to be released.  I'm not sure if they're actually going to use the music changes I did in the final version though (or if the hack is ever going to be released at all -- this was a year ago).

In fact... I still have that hack on my dropbox:   https://www.dropbox.com/s/ic1q58jztkfq0y4/ffnamcot.zip?dl=0    (The engine is in place, but it doesn't actually play any music because it'd all have to be re-scored and reinserted -- which I left up to the other guy)


The mapper is the easy part... it's working the audio into the music that's difficult.  You basically have to rewrite the entire music engine to really do it effectively.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 14, 2016, 05:31:09 pm
The Final Fantasy Reconstructed hack you mention is precisely what got me interested in this.  It seems there is still activity on that project and in fact I just spoke with the guy in charge a couple days ago. (Duke2go?)

I am not an expert with NES software hacking by any means but I have an OK understanding of 6502 assembler.  I like the hardware part of it better but maybe I can help with this!  I have a Namco-163 chip in non-glob form, and my hopes and dreams consist of finding a worthy game and building a cartridge with it.

I am a little unclear on one part of what you said.  You say that "working the audio into the music" is the hard part and you have to rewrite the music engine.  Did you already do this in your Dropbox ROM?  If so, does this boil down to a relatively simple but tedious task of rescoring and reinserting the music?  I may be willing to take on that challenge even if this results only in a normal Final Fantasy with Namco-163 music.  From that point, we could think about adding the changes into Final Fantasy Reconstructed.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 14, 2016, 08:35:14 pm
I am a little unclear on one part of what you said.  You say that "working the audio into the music" is the hard part and you have to rewrite the music engine.

Whooops.  I meant to say "working the music into the ROM".  I mangled that sentence up  =x

Quote
Did you already do this in your Dropbox ROM?  If so, does this boil down to a relatively simple but tedious task of rescoring and reinserting the music?

Yes and Yes.

The Dropbox ROM has the music ENGINE rewritten, as well as the format fully documented.... but no actual song data.  Someone would have to rescore and insert the music -- but hopefully that wouldn't be very difficult as the ROM is expanded and there's tons of space to work with.

Quote
I may be willing to take on that challenge even if this results only in a normal Final Fantasy with Namco-163 music.

Feel free.  Download link is already posted.  Let me know if you have any problems.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 15, 2016, 03:28:13 pm
Thanks for the info.  I know that there are some Final Fantasy Famitracker tunes out there that use various mappers for expansion audio.  Were any of these ever being considered for this purpose with Namco-163?  I would like to know because I can imagine other people being more creative than me, but I would be happy to give it a try on my own too.

I don't expect this to be an overnight project but maybe it is something I can chip away at little by little and see where it goes.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 15, 2016, 05:00:06 pm
Thanks for the info.  I know that there are some Final Fantasy Famitracker tunes out there that use various mappers for expansion audio.

Anything made in famitracker or <insert tracker here> is generally unusable.

Famitracker has a music driver that essentially has limitless RAM, ROM and CPU time.  In-game engines need to work under much more strict conditions because they have to run an entire game on top of running the music driver.  Working famitracker into a hack is even more difficult, since it's 99.999% certain that famitracker is going to be using RAM that the game is already using for something else.

So anything from Famitracker would have to be rescored and reinserted by hand -- just like anything else.

Quote
Were any of these ever being considered for this purpose with Namco-163?

Probably not, for above reasons.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 16, 2016, 09:12:36 pm
I guess I didn't really mean to say that I wanted to drop a tune in from Famitracker.  I understand the need for this to be completely rewritten for your music engine.  I was looking more for a creative source from which to replicate, or if there was something already being considered for this purpose that may even have had some Namcot sound samples implemented.  There is a lot of Final Fantasy music out there that I can probably draw off from though, even if it is not from a tracker.

I have poked at your ROM file a little bit.  I am at the "Hello World" point right now... (I have to start somewhere right?)  I wanted to play a single note first.  Then I could tweak things to make that note sound different, and try all of the different cool features of your music engine.  I have not been able to get that first note yet unfortunately.

Here is what I tried:

First thing's first, I looked at the channel pointer tables for each song (0x3E010 - 0x3E40F).  I notice that these are all 0x0000, which is the special value to disable the channel.  For this 1-note test, I wanted to use only pulse channel 0, so for song #0's pointer table, I inserted this data at 0x3E010:

0000 0000 0000 0000 0100 0000 0000 0000

This means:
 - Disable all channels except for pulse channel 0.
 - Because Namcot channel 0 is disabled, paging will be on the page containing the beginning of song data space (0x3E410).
 - Start Pulse channel 0 data at offset 0x0001, which equals 0x3E411.

I wanted this to be for the song that plays immediately when you start the game ("Final Fantasy Prelude"), which I'm betting is song #0, but instead of making this assumption, I copied the pointer table over all tables in the entire range 0x3E010 - 0x3E40F.  So, all songs should point to the same spot.

Then I went down to offset 0x3E411 and inserted the value 0x60.  Tried the game, no note played.

Then I went back to offset 0x3E411 and tried a few things and ended up with this:

F9 00 FA 87 00 FB 82 08 F6 60 60 B0

Which breaks down to:
 - F9 00: Set tempo to tempo table ID 0, which comes already populated at 0x3DE10 as:
  -- 1E 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09
 - FA 87 00: Following example, sets envelope to fixed volume 7, speed unused.
 - FB 82 08: Set Pulse channel to 50% duty cycle, with a speed of 0x08
 - F6: Set to octave 6 (had tried other values, this is where I ended up.)
 - 60: Play F# with length 1E (ID 0 in selected tempo table)
 - 60: Play F# again, same length
 - B0: Play B, same length


Would you help me figure out why the 3 notes did not play at the end?
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 16, 2016, 10:58:17 pm
If your music data starts at 0x3E411, your pointer would be $0401 (not $0001).  Subtract 0x3E010 from the offset to get the pointer value.

After that fix I did something similar and got beeps and boops:

At offset 0x3E410:
Code: [Select]
F9 00 FA 87 00 FB 82 08 F2 60 60 B0 E0 FD 00 0C
04

Same as you, only with a reasonable octave -- and I followed the final note with a rest, then an infinite loop that jumps back to the rest.

At offset 0x3E020 (the pointer table for the prelude):
Code: [Select]
00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00

Since my music starts at 0x3E410, my pointer is $0400 -- for pulse 1


Side note:  I tried the 'FF 00' marker to end the song before doing the reset + infinite loop.... and it didn't work -- which was a bit alarming.  I'll have to debug that.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 16, 2016, 11:34:50 pm
COOL thanks! :thumbsup:

I thought that the channel pointer was relative to the beginning of song data space 0x3E410 for some reason and it seemed kind of strange that the first byte couldn't be used that way.  So now my high-pitch squeaks work!  lol

I'm sure I will have more questions but this should get me going in the right direction for now.
Title: Re: Are there any Namco-163 hacks out there?
Post by: mrrichard999 on May 17, 2016, 01:05:13 am
This hack uses that Audio Mapper - http://www.romhacking.net/hacks/2633/ (http://www.romhacking.net/hacks/2633/)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 18, 2016, 10:53:00 pm
Thanks for the link, mrrichard999.

I have a couple of new questions now, Disch.

I have inserted this at location 0x3E028:3E029:

00 04

And I have inserted this starting at location 0x3E410:

F9 00 FA 01 08 FB 82 08 F1 A0 00 20 50 A0 F2 00
20 50 A0 F3 00 20 50 A0 F4 00 20 50 A0 50 20 00
F3 A0 50 20 00 F2 A0 50 20 00 F1 A0 50 20 00 70
90 A0 20 70 90 A0 F2 20 70 90 A0 F3 20 70 90 A0
F4 20 70 20 F3 A0 90 70 20 F2 A0 90 70 20 F1 A0
90 70 20 A0 90 FD 01 09 04 

All is well, except the loop at the end does not seem to work.  I wanted this to loop back to location 0x3E419 one time, then continue on afterwards, but instead the game locks up when it hits this.  Did I do the loop command properly?

My other question is:  What happens if I call a subsection from within a subsection, and should this be avoided?


May 19, 2016, 12:33:13 am - (Auto Merged - Double Posts are not allowed before 7 days.)

I have found that it works fine if I make it an infinite loop:

F9 00 FA 01 08 FB 82 08 F1 A0 00 20 50 A0 F2 00
20 50 A0 F3 00 20 50 A0 F4 00 20 50 A0 50 20 00
F3 A0 50 20 00 F2 A0 50 20 00 F1 A0 50 20 00 70
90 A0 20 70 90 A0 F2 20 70 90 A0 F3 20 70 90 A0
F4 20 70 20 F3 A0 90 70 20 F2 A0 90 70 20 F1 A0
90 70 20 A0 90 FD 00 08 04 70 A0 30 50 70 A0 F2
30 50 70 A0 F3 30 50 70 A0 F4 30 50 70 50 30 F3
A0 70 50 30 F2 A0 70 50 30 F1 A0 70 50 30 A0 90
00 50 70 90 F2 00 50 70 90 F3 00 50 70 90 F4 00
50 70 90 70 50 00 F3 90 70 50 00 F2 90 70 50 00
F1 90 70 50 00 60 A0 10 50 60 A0 F2 10 50 60 A0
F3 10 50 60 A0 F4 10 50 60 50 10 F3 A0 60 50 10
F2 A0 60 50 10 F1 A0 60 50 10 A0 80 00 30 70 80
F2 00 30 70 80 F3 00 30 70 80 F4 00 30 70 80 70
30 00 F3 80 70 30 00 F2 80 70 30 00 F1 80 70 30
00 FD 00 08 04

I could hard-code the loop too (i.e. copy / paste all the notes twice) but I would like to use this feature if possible.


Update


I have the full prelude put in now, except for the 1x loop.  Where the 1x loop goes, I have inserted 3 rests.  This is extremely true to the original now, and nothing added. (No Namco-163 audio yet.)

Inserted at 0x3D430 (envelope tables 1 and 2):
0F 0F 0E 0E 0D 0D 0C 0C 0B 0B 0A 0A 09 09 08 08
07 07 06 06 05 05 04 04 03 03 02 02 01 01 00 00
08 08 08 08 07 07 07 07 06 06 06 06 05 05 05 05
04 04 04 04 03 03 03 03 02 02 02 02 01 01 01 01

Inserted at 0x3DE10 (tempo table 0):
09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 01

Inserted at 0x3E020 (channel pointer table for song 1):
00 00 00 00 00 00 00 00 10 04 00 04 00 00 00 00

Inserted at 0x3E410 (song data):
F9 00 FA 02 18 FB 80 00 E0 E0 FE 18 04 00 00 00
F9 00 FA 01 18 FB 81 00 F1 A0 00 20 50 A0 F2 00
20 50 A0 F3 00 20 50 A0 F4 00 20 50 A0 50 20 00
F3 A0 50 20 00 F2 A0 50 20 00 F1 A0 50 20 00 70
90 A0 20 70 90 A0 F2 20 70 90 A0 F3 20 70 90 A0
F4 20 70 20 F3 A0 90 70 20 F2 A0 90 70 20 F1 A0
90 70 20 A0 90 E0 E0 E0 04 70 A0 30 50 70 A0 F2
30 50 70 A0 F3 30 50 70 A0 F4 30 50 70 50 30 F3
A0 70 50 30 F2 A0 70 50 30 F1 A0 70 50 30 A0 90
00 50 70 90 F2 00 50 70 90 F3 00 50 70 90 F4 00
50 70 90 70 50 00 F3 90 70 50 00 F2 90 70 50 00
F1 90 70 50 00 60 A0 10 50 60 A0 F2 10 50 60 A0
F3 10 50 60 A0 F4 10 50 60 50 10 F3 A0 60 50 10
F2 A0 60 50 10 F1 A0 60 50 10 A0 80 00 30 70 80
F2 00 30 70 80 F3 00 30 70 80 F4 00 30 70 80 70
30 00 F3 80 70 30 00 F2 80 70 30 00 F1 80 70 30
00 FD 00 18 04
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 19, 2016, 02:54:05 am
Sorry for late reply -- was out most of the day.

I'd rather not input this all by hand.  Can you throw a patch (or ROM - whatever... it hardly matters) up on dropbox or something so I can download and debug?
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 19, 2016, 07:42:11 pm
Okay, I have uploaded it here:

https://sites.google.com/site/benboldt2/files/ff_namcot.nes.zip

Let me know if you have any trouble with this link, I have not used it much lately.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 19, 2016, 10:01:38 pm
Jeez, I forgot to put a nameless label so it was jumping to a completely different block of code.

- Go to offset 3C289
- It will be $4B
- Change it to $16


That seems to [mostly] fix the looping, although it still sounds like there's a rest there.  I don't know if that's the engine or the score though -- I'll look into it more.


EDIT:

It was the score -- you're looping back to a rest.  Instead of looping to $0408, but you should be looping to $040A.


After those 2 changes (4B->16 and 08->0A), it works and sounds great!  Great job!


EDIT 2:

Sorry, I missed your other question.

Due to RAM limitations, I couldn't make it so you could nest subsections.  So a subsection cannot call another subsection.  If you try it it'll just screw up.  So yeah, that should be avoided.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 20, 2016, 01:32:48 am
I put in your changes and it works great now!  I had intended to loop back to 0x0418 for the 1x loop but your location has the same effect.

I plan to leave this song as-is at this point and work on another version of it that utilizes the Namco-163 expansion audio.  I tried building a Namcot table tonight with some new wave shapes, and then playing some notes, but no success getting the intended wave though yet.  I will start fresh on it again soon.

Edit:


No problem with non-nesting subsections.  I guess I am still a little bit curious about it.  Does the "enter subsection" work like a Goto, and then it stores the return address of the most recent time you use it?  So calling "enter" multiple times would just write over the return address each time?  Here's an example where I think multiple enters could be useful.  Say that you have the Super Mario Bros. NSF where there are copies of all of the level music for when time is running low.  It starts with a sound effect and then plays the same music faster than normal.  For this, you could have a separate song that just plays your sound effect, sets a faster tempo table, than "goto" the data for the normal level music, from which you will never go back.  Then within that "normal level" music data, could you enter and exit subsections as normal, even though you have had that extra enter in the past that you no longer care about?



I kind of hit a wall with getting Namcot audio to work.  I added a Namcot instrument table containing 4 waves:

(http://i.imgur.com/g1HUKOn.jpg)

This table is positioned at 0x3DC10, which is table 0.  I carefully avoided using the last 8 bytes because I was not sure if they had special function based on information here:

http://wiki.nesdev.com/w/index.php/Namco_163_audio (http://wiki.nesdev.com/w/index.php/Namco_163_audio)

I left the last 8 bytes as zero.  Is this the problem; do I need to research into how these registers work?

I then made sure that the Instrument -> song assignment table contained a 00 for song 1, and it did.  I then used these commands at the beginning of the song data:

F9 00
Use Tempo Table 0.

FA 8F 00
Set Envelope to fixed volume 'F'.  I noticed that this was louder than using example value 87 00.

FB 00 00
Use Namcot Instrument ID 0 within the selected Namcot table.  This is the yellow highlighted wave in the image above.

It does make sound, but not the yellow triangle wave.  If I try the other waves with FB0100, FB0200, or FB0300, it makes no difference.

Output waveform:
(http://i.imgur.com/FlPiiV1.jpg)

Latest ROM file:
https://sites.google.com/site/benboldt2/files/ff_namcot.nes.zip
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 21, 2016, 11:13:44 am
Does the "enter subsection" work like a Goto, and then it stores the return address of the most recent time you use it?

Yes.  Exactly that.  =)

As for your SMB example... the same could be accomplished by doing an "infinite loop", which also is effectively just a goto.


Quote
I kind of hit a wall with getting Namcot audio to work.  I added a Namcot instrument table containing 4 waves:

Ugh... How did I miss all these bugs before!  Sorry!

So I was writing to N163 regs backwards -- writing the length value to where the address should go and vice versa.

3 byte change to fix:

3C5CC:   64 -> 66
3C5D6:   C8 -> 88
3C5D7:   C8 -> 88


Thanks for finding these.  I'm actually surprised I didn't notice these huge bugs.  I swear I remember testing this and having it work  =x

Quote
This table is positioned at 0x3DC10, which is table 0.  I carefully avoided using the last 8 bytes because I was not sure if they had special function based on information here:

You can use all of it.  None of it has any special function.  The $60 bytes for instruments is placed at $00-5F in the sound RAM area, which leaves $60-7F for register space.

Quote
Is this the problem; do I need to research into how these registers work?

Nope.  The regs are handled by the engine.  You don't need to worry about it.  You just have to understand how to build the instruments -- which you clearly do  =)



Only other thing to mention:  The number of 4-bit samples in the instrument must be divisible by 4.  Or.. in other words.... the byte length of the instrument must be even.  You're currently using 0F for the length of the triangle which is odd and won't work properly.  This is casually mentioned in the doc but is very easy to overlook  =)



Thanks again!  If you run into more problems don't hesitate to let me know!   :thumbsup:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 22, 2016, 12:44:45 am
Okay, your magic bytes have gotten my sound waves to play!  But I am still having one issue.

Is each wave limited to 32 samples (i.e. 16 bytes)?  Because if I go over 32 samples, the wave gets truncated.  It works like this:

If I use 32 samples or less, no problem.

If I use 60 samples (cyan wave), I get 60 - 32 = 28 samples, and the frequency is too high.  (I'm betting if it played the whole wave each period, the frequency would be correct.)

If I use 56 samples (purple wave), I get 56 - 32 = 24 samples.  So it looks like the number of samples is truncated to 5 bits.
i.e. 60 & 0b11111 = 28
56 & 0b11111 = 24

Please don't tell me I have to limit to 32 samples!   :-\

Waves adjusted to have sample count divisible by 4:
(http://i.imgur.com/Cx53vDS.jpg)

Instrument 0, Beautiful:
(http://i.imgur.com/X2pPni2.jpg)

Instrument 1, Beautiful:
(http://i.imgur.com/gB8w476.jpg)

Instrument 2, truncated:
(http://i.imgur.com/6EPVBWC.jpg)

Instrument 3, truncated:
(http://i.imgur.com/EKY2hJP.jpg)

Instrument 4, Beautiful:
(http://i.imgur.com/j6Hmkfw.jpg)

ROM file updated with new Namcot table and set to play using the cyan wave:
https://sites.google.com/site/benboldt2/files/ff_namcot.nes.zip
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 22, 2016, 04:44:32 am
Aye-ya.  Nah this is probably me screwing up the instrument length.  You definitely are not limited to 32 samples -- the cap is 256.  I'm probably just chopping off some bits or something.

I'll look at this tomorrow morning.

Thanks again for doing all this and exposing these bugs.  And for the great graphics & binaries!  It makes it so much easier to debug!  :beer:

May 22, 2016, 04:22:15 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Soo... I wanted really bad for this to be a error in my code.  But it looks like errors in the emus.

FCEUX and NEStopia both seem to be using old Namco-audio documentation and not the latest that posted on the wiki.  This old documentation DID limit instruments to 32 sample lengths.  I even double-checked and ran Rolling Thunder (J) in each of them (which plays the music at too high a pitch with this old method), and both of them play the music incorrectly.

I didn't verify NEStopia source, but FCEUX source is definitely wrong:

line 146:
https://sourceforge.net/p/fceultra/code/HEAD/tree/fceu/trunk/src/boards/n106.cpp#l146

Code: [Select]
LengthCache[w] = (8 - ((V >> 2) & 7)) << 2;

Here, 'V' is the length reg.  This does the inversion and then left-shifts by 2.  But it does 8- and &7 (instead of 64- and &63)

As such, the largest sample would be when V=0... which will get you a length of 8*4 = 32.


=(

Sorry.  Short of someone updating the emus (which I'm not really willing to do), we're stuck.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 22, 2016, 10:39:26 pm
Bummer!  32 samples it shall be.

Moving forward, I will develop using the full waves that I want, and stick in waves squished down to 32 over top of them.  I had planned on building a cartridge with a real Namco-163 chip for this eventually, so maybe that can shed some light on this and/or persuade the emulator authors to do an update!

Anyway, thanks for your help with this.  As I develop these scores, I think that I will need to start a new thread in the personal projects section for sharing updates.

Edit:


Crap, I am running into another problem.  I can only use Namcot channel 0 (I had not tried channels 1 2 or 3 yet until just now.)  I noticed this when trying to add channel 1 in addition to channel 0.

I will provide a new ROM file to demonstrate this soon.  You can reproduce this by taking my latest ROM file, and actually just moving the channel pointer from Namcot 0 to any of the other 3 Namcot channels.  But I will provide a ROM with 2 separate Namcot channels for you soon.

Edit 2:


Here is the ROM file updated with Namco channels 0 and 1 being used, but only channel 0 produces sound:
https://sites.google.com/site/benboldt2/files/ff_namcot.nes.zip

And here is an audio file for what it should sound like if both channels were working (I recorded each through channel 0 and then superimposed them in an audio app):
https://sites.google.com/site/benboldt2/files/Output%201-2.mp3
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 23, 2016, 11:32:55 am
My weekend is over so I won't have as much free time to debug this.  I'll try to get to it sooner rather than later but it might take me a day or 2.  I'll send you a PM (and reply) when I finally get to it.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 24, 2016, 01:11:22 am
No problem Disch, take your time.  I really appreciate the support.  I started work on building a cartridge for this, that will keep me plenty busy for a while.  Bandai Golf is the casualty this time.   ;)   Not shown yet, I will be adding Flash PRG ROM, W-RAM (supporting battery), and CHR-RAM.

(http://i.imgur.com/3Kznoyg.jpg)

Edit:


Update!  I made a lot of progress on the Namco-163 cartridge.  It actually powers on and plays expansion audio now, but graphics are screwed up.  I need to look deeper into how the CHR-RAM chip is hooked up.

(http://i.imgur.com/IvZvYN8.jpg)

(http://i.imgur.com/NOn8ctX.jpg)

Two VERY interesting discoveries with the real Namco-163 hardware!

1.) The complete sample plays properly and sounds right even if it is more than 32 samples.  Great job on the code, Disch.

and... (drumroll...)

2.)  The sample plays INVERTED!   ;D   I am betting that it always plays upside down for every game!  Look closely at my scope capture, compared to my 4th wave, and you'll see.

(http://i.imgur.com/sgZopKh.jpg)

(http://i.imgur.com/Cx53vDS.jpg)

It matches if you look at it this way:

(http://i.imgur.com/p9CFgZm.jpg)

Mind you, this is running on a modified US Nintendo, so it may be that my setup is causing this inversion.  We would have to try a game on a real Famicom to be sure.

Edit:

I was playing around tonight trying to get the CHR-RAM to work, and amidst my testing, I heard 2 Namcot channels playing simultaneously.  It was glorious, it sounded great.  I could keep hitting reset and they kept both working. Then I powered off and back on, and it was back to just 1 channel.  It sounds like RAM of some sort that affects this is not being initialized.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 29, 2016, 02:52:26 pm
Sorry for slow reply.  I'm approaching finals week so I haven't had a lot of time to work on this.

Finally got around to it and it was a stupid indexing error.  I was indexing a variable when I shouldn't have been, so it was effectively taking the tone the channel should be playing from garbage RAM.

Fix is easy:

Change offset 3C5EC from B5 to A5



Regarding the graphics:  I'm a little worried about that.  I wonder if N163 is set up to work with CHR-RAM.  I just assumed it was, but come to think of it, all its games might have been CHR-ROM  =x.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 30, 2016, 12:47:24 am
I put in your wonderful byte and now all 4 Namcot channels are working great:

Emulator (Nestopia):
https://sites.google.com/site/benboldt2/files/nestopia_prelude.mp3 (https://sites.google.com/site/benboldt2/files/nestopia_prelude.mp3)

The cartridge with real Namco-163:
https://sites.google.com/site/benboldt2/files/actual_nes_prelude.mp3 (https://sites.google.com/site/benboldt2/files/actual_nes_prelude.mp3)

There are differences between the two!  But not too bad.

Here is the latest ROM file:
https://sites.google.com/site/benboldt2/files/ff_namcot_prelude.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_prelude.zip)

I had to make a tool for entering the notes because leaving enough ROM space between channels and keeping track of addresses and looking up the hex value of each note was too tedious.  So I made a very dirty hack that takes a text file, parses it out, and spits out an updated iNES ROM file.  This is why all of the song data is all squished together into 1 chunk now.

I also made progress with the CHR-RAM today, it is now displaying the opening screen and name selection screen perfectly, but when it comes to the world or inside the town or castle, the graphics still have issues.  I feel very confident that it will work when I figure out how to hook it up right.  I don't know how to verify if W-RAM is working, but the game is not crashing, so that must be a good sign.  Adding the battery to the W-RAM will be future development.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 30, 2016, 03:57:31 am
I put in your wonderful byte and now all 4 Namcot channels are working great:

Huzzah!  This is fantastic!  =D =D

This is awesome.  I'm really glad you're doing this.  I'm very excited to see how this turns out.  The music sounds great so far!

I couldn't help but notice a sharp buzzing at the start of the actual NES recording.  I wonder if I'm not properly silencing the Namcot channels on bootup....  I'll take a look at that tomorrow.


Quote
I had to make a tool for entering the notes because leaving enough ROM space between channels and keeping track of addresses and looking up the hex value of each note was too tedious.  So I made a very dirty hack that takes a text file, parses it out, and spits out an updated iNES ROM file.  This is why all of the song data is all squished together into 1 chunk now.

Yeah that's for the best.  The thing that stopped me from actually scoring this was that I didn't want to hassle with working by hand in a hex editor, and I didn't want to write a tool to do the conversion.

Quote
I also made progress with the CHR-RAM today, it is now displaying the opening screen and name selection screen perfectly, but when it comes to the world or inside the town or castle, the graphics still have issues.  I feel very confident that it will work when I figure out how to hook it up right.

Also great news!   :thumbsup:

Quote
I don't know how to verify if W-RAM is working, but the game is not crashing, so that must be a good sign.  Adding the battery to the W-RAM will be future development.

Map data is stored in WRAM.  So if you can walk around the overworld and enter/exit Coneria (even if the graphics are screwed up), then WRAM must be working.
Title: Re: Are there any Namco-163 hacks out there?
Post by: mrrichard999 on May 30, 2016, 04:19:23 am
Oh, here is the persons twitter acct for the one who did that Mappy hack using the Namco mapper just in case you want to ask questions - https://twitter.com/makimura_mfg
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 30, 2016, 06:18:32 pm
Thanks for the link mrrichard999.

I wasn't too worried about the sharp buzz, but it does do it every time.

Great news, I got the graphics working.  For the CHR-RAM /CS pin, I had to use PPU A13 directly instead of the "CHR A13" provided by the Namco-163.  Also, I had originally changed CHR-RAM A10 in a similar way.  When I switched it from Namco "CHR A10" to PPU A10 directly, that is what got the title screen and other non-scrolling screens to work.  Everything seems to work now, but that does not necessarily mean that this is the ideal/correct pinout!  I do not have any underlying understanding of the difference between direct PPU connection and going through the Namco-163.  This was all just experimentation and guessing.  The resulting hookup was just like the original Final Fantasy cart: only CHR-RAM A12 was connected to the mapper chip.  All others have direct PPU connections.

Here is a pinout of how I hooked this up.  Note that my SRAM chips are 32k instead of 8k, so they have A13 and A14, both of which I tied to 0, effectively turning it back into an 8k chip.


                   HM62256BLP
               256kbit (32K) SRAM
              For Namco-163 CHR-RAM
                _________________
                |       V       |
            0 --| A14       VCC |-- +5V
Namco CHR A12 --| A12       /WE |-- PPU /WR
       PPU A7 --| A7        A13 |-- 0
       PPU A6 --| A6         A8 |-- PPU A8
       PPU A5 --| A5         A9 |-- PPU A9
       PPU A4 --| A4        A11 |-- PPU A11 (Not Namco)
       PPU A3 --| A3        /OE |-- PPU /RD
       PPU A2 --| A2        A10 |-- PPU A10 (Not Namco)
       PPU A1 --| A1        /CS |-- PPU A13 (Not Namco)
       PPU A0 --| A0         D7 |-- PPU D7
       PPU D0 --| D0         D6 |-- PPU D6
       PPU D1 --| D1         D5 |-- PPU D5
       PPU D2 --| D2         D4 |-- PPU D4
          GND --| D3         D3 |-- PPU D3
                |_______________|
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 30, 2016, 07:43:54 pm
By bypassing the Namco pins you're effectively tossing aside the CHR swapping controls of the mapper -- which is fine because Final Fantasy doesn't do any swapping anyway.  Though I'm curious as to why it wouldn't work with the Namco pins -- unless the mapper only forwards reads because it assumes the memory is ROM?  But then why would Namco's A12 work?

Whatever.  As long as it's working.  =)

I guess I'm more wondering if my mapper setup code isn't setting CHR regs properly.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 30, 2016, 10:29:59 pm
Well, at the very least Disch, we have emulated the emulator in hardware.   :D

I was doing some process of elimination to map out the song IDs today.  It seems to pretty much follow the order of songs in the Final Fantasy NSF.  Are #0 or #24+ used for anything?  I notice that there is space for 64 song channel pointer tables.  Can 24 through 63 be used for future expansion, such as boss music?

I marked ones that I got from the NSF with "( )?".

0 = ?
1 = Prelude: Title Screen / Name Selection
2 = (Main Theme) ?
3 = (Ending) ?
4 = Overworld
5 = (Ship) ?
6 = (Airship) ?
7 = Town
8 = Corneria Castle
9 = (Gurgu Volcano) ?
10 = (Matoya's Cave) ?
11 = (Dungeon) ?
12 = Broken Castle
13 = (Floating Castle) ?
14 = (Chaos' Temple) ?
15 = Shop
16 = Battle
17 = Menu
18 = (Dead Music) ?
19 = (Victory Music) ?
20 = Got special item
21 = Lineup Screen (expected treasure chest item based on NSF)
22 = Saving in the Inn
23 = (Healing sound effect) ?

When I beat Garland and talked to the old man where he builds the bridge, it triggered the "Got special Item" sound effect (#20).  I put an "end" in there (0xFF 00) but it still makes the game get stuck.  I put some notes before and after the "end" marker, and it plays all of the notes, as if the end marker wasn't there.  I only tried this in the Namcot 0 channel.  But it will be a very long time before I need to cross that bridge; it's just something to be aware of for now.

Hopefully as I do more of these songs I will become better at using this engine and I can revisit the Prelude and make it better.  It doesn't quite sit right with me the way it is now.
Title: ###
Post by: FCandChill on May 30, 2016, 10:59:20 pm
 Comment removed because reasons...
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 31, 2016, 12:16:30 am
Are #0 or #24+ used for anything?  I notice that there is space for 64 song channel pointer tables.  Can 24 through 63 be used for future expansion, such as boss music?

0 probably isn't usable because of the way the game triggers a new song to start.  24-63 are free to use, though you'll have to make changes to the game to get those songs to actually be played.  64+ definitely cannot be used because bit 6 and 7 are special flags used by the music driver.

I'll try to verify the song list later tonight.

Quote
When I beat Garland and talked to the old man where he builds the bridge, it triggered the "Got special Item" sound effect (#20).  I put an "end" in there (0xFF 00) but it still makes the game get stuck.  I put some notes before and after the "end" marker, and it plays all of the notes, as if the end marker wasn't there.  I only tried this in the Namcot 0 channel.  But it will be a very long time before I need to cross that bridge; it's just something to be aware of for now.

Ugh.  Yeah I forgot about this, but now that you brought it up I remember finding a problem with the end marker on the first page.  I'll have to look into it.




Do note that the Final Fantasy NSF doesn't have all the sound effects in the game like the attack one for example. Usually this happens because they are too hard to rip.

They're not in the NSF because they're not driven by the music engine.  The game hardcodes the audio register writes in the game code - completely separate from the music.  I think battle sound effects actually do have a sort of separate mini-engine used to drive its sound effects, but nothing else in the game really does.

But yeah that includes anything using the noise channel (airship propellers, ocean waves when in the ship, attack/getting hurt sound effects), and really simple pulse-wave pitch bends (dialogue window opening/closing, cursor movement, etc).
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on May 31, 2016, 02:52:54 pm
Ugh.  Yeah I forgot about this, but now that you brought it up I remember finding a problem with the end marker on the first page.  I'll have to look into it.

Could I just put this on the next page of memory then?  I would totally be OK with doing that as a workaround.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on May 31, 2016, 07:19:48 pm
Could I just put this on the next page of memory then?  I would totally be OK with doing that as a workaround.

Oh no I meant the first page of this thread.  Not the first page of memory  XD
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 03, 2016, 12:58:05 am
LOL that's pretty funny, I seriously thought you were talking about memory paging.   :)

I have some progress to report.  I have improved the prelude and started working on Coneria Castle.  I am modeling this one after the PSX version.  I got to the part where it needed a snare drum and I had some trouble with the noise channel.  I noticed that there is some example data included for the first Noise/Percussion effect at 0x3D810, so I tried playing it with byte 0x08 and 0x00 and nothing happened.  If I attempted to use a rest (0xEx), it would crash the game.  If I put in an envelope 0x82 00, it also crashes.  (I doubt it's valid to use envelope on the noise channel, I was just trying things.)

I'm not really sure what I am doing with the noise channel yet -- I think it's very possible that the only issue with it is that I just don't understand how it works.  Could you give me some pointers or provide an example that I could follow?

New files (Coneria Castle incomplete):
https://sites.google.com/site/benboldt2/files/ff_namcot_coneria.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_coneria.zip)

This also includes the super ultra sloppy code that I am using to enter the scores.  It is quite crude and kluged together but it turns my text file score into a .NES file with 1 click!  I make a small change in the text file, run the shell script, open the new NES file and hit defrost.  It works great.  Depending on what I edit, I may have to run the song form the beginning in some cases.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on June 03, 2016, 02:10:35 am
Your download got filtered out by windows virus scanner and I didn't want to take the effort to try it get around it.  Probably because of the script.  Whatever.  So I didn't get to listen  =(


Noise has a completely different score format since it doesn't really play "tones" like the other channels do.  The only things that are the same are F8/FD/FE (loop and subsection commands).  Other stuff is changed or removed completely.  Ctrl+F the readme for "NOISE SCORE FORMAT:"


It basically operates on the idea that you'll have a bunch of "effects" that you'll want the noise to play.  Like a snare drum, or whatever would be one effect.  The details for this effect would be put in the noise effect buffer at offset 0x3D810.  I have a really ugly effect in there which is there just so I could do basic testing.

The effect data goes in what I call "slots", but that's kind of a misnomer.  Really I just wanted to avoid a pointer table, so all effects have to start on a $10 byte boundary, and the "pointer" is the effect ID.  That is, effect $10 (the first effect) starts at 3D810, $11 (2nd) starts at 3D820, $12 starts at 3D830, etc.  Apart from the starting point, and being restricted to the 3D810-3DC0F range, there isn't really a boundary on individual effects.  So a single effect can take $100 bytes if you want.


Ctrl+F the doc for "NOISE EFFECT FORMAT" to see how the effect data is stored.  This requires a bit of understanding of how the noise APU registers work -- but it's pretty simple.

full reference:  http://wiki.nesdev.com/w/index.php/APU_Noise

For a simplified version, you can ignore the length counter by disabling it, and just control the channel 100% through the volume.  If that reference page is too dense, here's a breakdown:

$400E sets the pitch and the mode.  Noise can only play $10 pitches... controlled by the low 4 bits.  Higher pitch values = LOWER pitch.  So a pitch of $0 is a really really high pitched "ting" sound... whereas pitch $F is a deep rumbling.

$400E.7 (high bit) selects the mode.  When clear, you get the traditional "shhhh" style noise.  When set, you get a "bzzzzz" style noise.  A popular example of the "bzzzz" noise is quickman's theme in MM2:  https://youtu.be/uGuHOyiYOTA


$400F kind of doesn't matter unless you use the length counter... which you probably won't.  It's entirely optional.  Length counter is like an automatic shutoff for the channel after a certain period of time.  But it might be easier to control that through a volume change.  Unless you want to deal with the length counter, you can just set this to $10 to give the longest length possible.


$400C is volume control, and is kind of tricky.  There's basically 3 volume effects:

- Normal/Fixed volume control = $3x where x is the volume
- Volume that starts and F and decays to 0 and stops at 0 = $0x where x is the decay speed (lower=faster)
- Volume that decays F->0, but with wrapping:  FEDC...3210FEDC... etc  = $2x where x is decay speed

$1x will be fixed volume but with length enabled -- so you don't need it unless you want to use the length counter.



The noise effect data is just the values to write to each of these regs.


I have no idea if this will actually produce a cymbal-like sound (you'll probably have to experiment), but say you want to make a cymbal with the following writes:

$400C = 3F      fixed full volume
$400E = 05      medium/high pitch
$400F = 10      don't care about length
<<wait 4 frames>>
$400C = 02      reasonably fast decay
$400E = 06      slightly lower pitch
$400F = 10      still don't care about length
<<wait 1 frame (minimum)>>
<<end of effect>>

This effect would need $0C bytes in the effect buffer:

Code: [Select]
04 3F 05 10     01 02 06 10     00 FF 00 00

The first 4 bytes being the first set of reg writes
The next 4 being the next set
And the last 4 being the "end of effect" marker.



Say you put this as the first effect... so those 12 bytes are at offset 3D810.  You would trigger this effect in the music score data with the "perform effect" command 10, followed by a 0x 'wait' command... where 'x' is the tempo-controlled note length used by other channels.

So if note length 0 was a single beat, and you want your noise to play this cymbal every 4 beats, your score could look like this:

Code: [Select]
10 00 00 00 00 FD 00 xx yy
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 03, 2016, 12:18:53 pm
Thanks for the info Disch.  I will take some time this weekend and read carefully through your reply and let you know how it goes.

I had included my shell script in the zip file.  I am thinking that is what caught your virus scanner.  When I get Coneria Castle finished, I'll upload again without the shell script.

Edit:


I really want to say I'm sorry for not reading more carefully here.  I had seen your instructions section "noise effect format", but not "noise score format".  Also, I did not see that you had already suggested that my shell script is the likely reason for the virus detector catching it.  I guess I've been a little detached lately.   ::)

I have updated some things here and I am able to get some noise sounds through now.  We'll see how it goes, thanks again.

Edit:


I think I understand the noise channel enough now to use it.  Here are some audio recordings:

Nestopia, 32-sample waves:
https://sites.google.com/site/benboldt2/files/coneria_nestopia_32_sample.mp3 (https://sites.google.com/site/benboldt2/files/coneria_nestopia_32_sample.mp3)

Real Namcot-163 in NES, 32-sample waves:
https://sites.google.com/site/benboldt2/files/coneria_nes_32_sample.mp3 (https://sites.google.com/site/benboldt2/files/coneria_nes_32_sample.mp3)

Real Namcot-163 in NES, 48-sample waves:
https://sites.google.com/site/benboldt2/files/coneria_nes_48_sample.mp3?attredirects=0&d=1 (https://sites.google.com/site/benboldt2/files/coneria_nes_48_sample.mp3?attredirects=0&d=1)

Files, without shell script:
https://sites.google.com/site/benboldt2/files/ff_namcot_coneria.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_coneria.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on June 05, 2016, 05:52:36 pm
I really want to say I'm sorry for not reading more carefully here.

Hahaha, it's no problem.  I don't mind at all.  =)   And pretty cool setup with the music-insertion program!  That's much better than working in a hex editor.

The music is sounding great, too!  Woooo.



In other news, I debugged the reason why the "end song" marker wasn't working.  I uploaded a fix for that -- as well as a tweak which disables all audio immediately on reset (this hopefully should fix the ugly BUZZ that happens).  This required some reassembling, so a lot of code is being moved around -- so I have to give it to you in the form of an IPS:

https://www.dropbox.com/s/ajtd8ffis0hj2k9/namcot_update.ips?dl=0

I compared the IPS to the file you gave me in the most recent post, so this patch should not overwrite any of your changes -- it just changes the code for the music engine, and one routine in the main bank.  But back up your stuff anyway just in case!

Let me know if that fixes the problem.



If you want a [relatively] quick way to test for yourself.... you can change two bytes at 0x00986 from "05 BF" to "03 00".  This will unlock the doors in Coneria Castle that have the TNT and other items, so you can just run in and grab them and get the jingles to play.


EDIT:

Blah.  I just realized I screwed something up and that IPS won't work right.  I'll fix and reupload in a bit


EDIT 2:

Nevermind ... I actually DID fix that thing in the copy I uploaded.  False alarm!
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 06, 2016, 01:49:19 am
I merged in your new code and it definitely fixed the scratchy sound at init:

https://sites.google.com/site/benboldt2/files/init_glitch_fixed.mp3 (https://sites.google.com/site/benboldt2/files/init_glitch_fixed.mp3)

The single pop that you still hear is completely normal for the Nintendo when power is applied.  In fact, it makes this sound even when powering it on without a cartridge.  But the noise from before is definitely gone - good job.

I have done the town music now, but I find that it is much quieter than the others.  I'm not really sure what to do about this yet, I will have to continue poking at it.  I think it would work for it to be a little bit quieter than the other music, but this is too much quieter I think.  I also updated the Coneria Castle music a little bit.

https://sites.google.com/site/benboldt2/files/ff_namcot_town.nes.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_town.nes.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on June 06, 2016, 01:59:49 am
hmmm... I noticed the music hangs during the map transition.  The original game is probably silencing the main channels but not the Namco channels.  I'll probably have to search the entire game for all 4015 writes and replace them with a routine call.  Blarg.

Not sure what would cause the volume difference apart from the obvious things (Lower in-score volume / Namco instruments not spanning full depth)... but yeah I do notice the town music is noticably quieter.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 06, 2016, 02:35:32 am
I am pretty sure it is quieter because of the aggressive envelope I have on it to make it sound like a string pluck.  I had to quiet down the flute-like instrument to match.  The flute one definitely has the potential of being quite loud; i have it dialed down to a half.  I may end up having to abandon the idea of using a guitar-like sound for this but you never know.

I have only heard the music hang during the screen transition.  I know that doors opening and closing works fine, and in fact it coexists quite well with music being played on the noise channel.  The dialog boxes also work great.  I don't use the pulse channels on Coneria Castle, and I noticed that I had to put a looping rest on them for the dialog box sound to work right.  But it's just fine with that rest in there.

I produce all of the sound waves with Photoshop.  I take a screenshot of a period of a sound wave, scale it to 16x32, then trace it with a pixel editor.  Then I take the image, rotate and flip it, paste it into a different graphics program, save it as 1-bit raw data, copy/paste that into Excel, which does a log base 2 on each 16-bit row, and spits the data back out with the nibbles flipped, then I paste that into the FF_Namcot ROM with a hex editor.  Pretty convoluted but it works, and I think it's pretty hilarious that my sound waves come from Photoshop.

Edit:

Just wanted to give a quick update.  I now have CHR-RAM memory mapping working properly through the Namco-163 chip, as detailed here:

http://forums.nesdev.com/viewtopic.php?f=9&t=14312&sid=a887da8dbbf1ee2c5d647a8512e6d221 (http://forums.nesdev.com/viewtopic.php?f=9&t=14312&sid=a887da8dbbf1ee2c5d647a8512e6d221)

I have managed to increase the volume of the town music by introducing the pulse channels, and I think it is okay now but maybe could use some additional polishing.  This will be included the next time I upload a file.  (not yet!)

I have started work on the Chaos Temple music.  I am trying to use Final Fantasy Origins (Playstation) as a source for this one too.  The first thing that I do in my process is to score out the music in Apple Logic using "Amazing Slow Downer".  (I am using a PowerPC Macintosh for all of this.....)  Once I get all of the notes nailed down to where they sound right, I can then easily enter them directly into the text file score format.  After that, I play with waves and envelopes and such using Photoshop, then tweak and run in Nestopia repeatedly.

Right now on the Chaos Temple, I have the score partially entered into Logic.  This one may take me a little while.  I think that a reasonable goal should be to get 1 song done every 1 - 3 weeks, depending on the complexity of the song.

In other news, I think I am going to just stick with 32 samples for all sound waves.  For most things it doesn't make a huge difference, or else it just makes it sound more "8-bit", and I think I can work with that.

Edit:

I was really having trouble figuring out the harp in this one.  My "minipsf" player can mute channels but all of the different instruments are scrambled around onto all of the different channels in this one - probably to get the most overlapping of notes possible out of the Playstation.  So, I ended up spending the whole evening ripping all 24 tracks individually and slicing them all up to delete all of the non-harp parts. That was very tedious, but now with this file:

https://sites.google.com/site/benboldt2/files/harp%20only.mp3 (https://sites.google.com/site/benboldt2/files/harp%20only.mp3)

I can use it to figure out the notes and then eventually get them into the Final Fantasy ROM.

Edit:

I have most/all of the notes figured out in the song now.  I am going to declare Phase 1 complete on this one!

https://sites.google.com/site/benboldt2/files/chaos_temple_transcribed.mp3 (https://sites.google.com/site/benboldt2/files/chaos_temple_transcribed.mp3)

Note that this audio comes from Logic, not from Namco-163!  I have not actually even entered 1 byte into the ROM for this yet.  Also, this is much slower than I plan for it to be in the actual game.  I am using this only for "big picture" of the notes, lengths, and rests.

Edit:

Here is the latest ROM file.  It is becoming apparent that Coneria Castle is way too loud.  I will need to quiet that one down to match the others.  For demonstration purposes, the Chaos Temple music plays in the overworld instead of in the actual Chaos temple.

https://sites.google.com/site/benboldt2/files/ff_namcot_chaos.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_chaos.zip)

Here are the songs included:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 14, 2016, 09:39:41 am
I did some very beneficial tweaks to the existing songs last night:

I am aiming for a quieter overall volume now in order to accommodate more dynamics.

New file:
https://sites.google.com/site/benboldt2/files/ff_namcot_chaos_2.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_chaos_2.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: resq on June 16, 2016, 02:49:49 am
ok umm whatever it is you wizard people are doing . . it's pretty cool!  :o
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on June 16, 2016, 03:51:22 am
I've been distracted with another project so I haven't looked at this thread in a while.  =x

So I need to fix two things:

- music hanging for map transition
- 2nd pulse not silencing after dialog box if the channel is disabled for music


Was that everything?  I'll try to get to those soon.

Also, keep up the great work, Ben Boldt!  =D
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 17, 2016, 11:21:47 am
Thanks resq, Disch is the real genius here, building this awesome sound engine and porting Final Fantasy to Namco-163 memory mapper.  I am just an artist that figured out how to use a hex editor.   ;)

Disch, the music hanging thing would be a nice fix.  But I can totally work around the pulse channel 1 issue with dialog boxes though.  All I have to do is point all unused pulse channels to a looping rest.  I am totally okay with that, and in fact I can just add that to happen automatically with my assembler/compiler thing.  Not a problem in my mind.
Title: Re: Are there any Namco-163 hacks out there?
Post by: w7n on June 24, 2016, 06:35:53 am
One question here:
Last time I generated an NSF using an altered FamiTracker engine. Though from the sound port writes log it seems as if all the writes are done in proper order, at certain points the sounds don't output correctly and instead output clicking noises instead (emulated in NSFPlay and is likely the same case on hardware).
Would you be kind enough to look into this problem? At the starting stage I choose VRC7 for my ROM hack but I'm considering changing the mapper to Namco 163 too, and I'm just worried about this problem. I can provide you the NSF if you want to.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on June 24, 2016, 09:23:28 am
Strangely I had the "missing notes" problem when writing emulators, but I don't remember what the problem was or what I did to fix it.   :-[

Unfortunately I don't have the time to troubleshoot it for you, as I have my own project I'm busy with (and I still need to find the time to fix the music hanging in the engine Ben Boldt is using -- I swear I'll get to that eventually!).
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 26, 2016, 01:54:47 am
UPDATE

Gurgu Volcano

Binary:
https://sites.google.com/site/benboldt2/files/ff_namcot_volcano.nes.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_volcano.nes.zip)

Nestopia Recording:
https://sites.google.com/site/benboldt2/files/ff_namcot_volcano_nestopia.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_volcano_nestopia.mp3)

Actual Nintendo recording:
https://sites.google.com/site/benboldt2/files/ff_namcot_volcano_actual.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_volcano_actual.mp3)

It is looking more and more to me like the emulator sounds more "correct", so I may need to reconsider how my hardware is set up.  It is too quiet and too muddy.

I am pretty sure I remember putting a cap on my Namcot audio signal to ground, copying the original cartridge that the Namco-163 chip came from, so I could reduce that.  There isn't much I can do on its own to increase the volume, though.  So I may need to put an op-amp in there to boost the signal up just a little bit.  It's not quite an original / ideal situation to add this amplifier but it's a 72-pin cartridge anyway so I guess this will just be compensating for the different setup.

Edit:


I removed the cap from Namco audio to GND, and now it sounds nearly identical to Nestopia!  Yay!
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on July 12, 2016, 01:06:52 am
With great difficulty, the world music is now mostly transcribed into Apple Logic (slow motion as usual).  Same as last time, this is the critical step #1 that needs to be complete before touching the Nintendo ROM.  The original Final Fantasy Origins song does have one additional "repeat" before looping that is similar, but different, than what I have done here:

https://sites.google.com/site/benboldt2/files/world.mp3 (https://sites.google.com/site/benboldt2/files/world.mp3)

On a related note, I have found an incredibly helpful program called VGMtrans.  This manages to convert .minipsf files into MIDI.  The MIDI file it creates sounds terrible, but I can open it in an editor and find notes.  This really helps a lot.

Edit:


I went ahead and updated the score and mp3 file with the correct repeat.  The song would now loop like this file from end to end.

(http://i.imgur.com/V55PdOT.jpg)

Edit:


I have something playing in the ROM file now!

https://sites.google.com/site/benboldt2/files/ff_namcot_world.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_world.zip)

Nestopia:
https://sites.google.com/site/benboldt2/files/world_nestopia.mp3 (https://sites.google.com/site/benboldt2/files/world_nestopia.mp3)

Actual NES:
https://sites.google.com/site/benboldt2/files/world_actual_nes.mp3 (https://sites.google.com/site/benboldt2/files/world_actual_nes.mp3)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on July 15, 2016, 01:41:15 pm
Woooo!  It's sounding great!

I finally got around to fixing the problem where the music hangs during map transitions.  Patch for that fix is here.  Please please please back up your stuff before applying just in case I screwed something up.

https://www.dropbox.com/s/aghncsvuxkgm53f/namcot_hang_on_transition_fix.ips?dl=0


The problem with the dialogue box sound effect going too long if you're not using Pulse 2 is still there -- but since you had a functional workaround for that I got lazy and decided "meh it's good enough".  ;P

Let me know if this works and if other problems come up.  I suspect there might be issues with the noise conflicting with the in-battle sound effects -- I'm not sure how well I tested that... if I tested it at all  =/
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on August 01, 2016, 07:26:23 pm
Sorry for the delayed response!  I have been a little bit busy lately and enjoying summer, etc.

I have an update where I put in your patch, Disch.  I have also done some tweaks to the world music in this.  I am beginning to be happy with the world music at this point.  The Gurgu Volcano one really does not sit right with me, so at the end I might come back and try again on that one.

The song that I can do next really depends on my mood.  There are times when I can do the mysterious / evil / hopeful / confident Chaos Temple, and there are times when I can do the viscous / gallant / grinding battle theme.  Hopefully I can do the battle music soon because that's the biggest missing piece at this point to make the game somewhat playable.  I also have the Prologue that needs to be done and that's a completely different state of mind to do that one.

Based on what I see with the noise channel in Coneria Castle when going through doors, I expect noise to be a problem with battle sound effects.  (i.e. cutting the sound effects short.)  I may be able to avoid the noise channel or possibly produce noise with the Namcot-163.  But then this takes away a Namco channel from other uses...  So I'll play with that and we'll see what happens.

Summer is my big weakness right now.  I have a season pass to the local amusement park and there are all sorts of beautiful biking trails here in Minnesota.  But on the flip side, it's terrible outside most of the year here so you can expect a lot more progress on this as we get into late fall / winter.

In other news, I found a dual 2.5GHz 64-bit Power Mac G5 at a thrift store for $37.50, which works perfectly, so I ended up with a huge upgrade to my old G4.  :)  The oldest version of Sonic Visualizer runs on the G5 so now I can do audio spectrum analysis directly without jumping over to one of my Windows PCs.

Edit

Oops I forgot the link:

https://sites.google.com/site/benboldt2/files/ff_namcot_world_with_updates.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_world_with_updates.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on August 25, 2016, 11:09:33 pm
Surprise!  I have the battle music pretty much done!  ;D  This does not include the victory or death music, so please do expect some silence at the end of the battle if you play it.  It also contains no percussion sounds.  I think this is okay and it accentuates the battle sound effects when playing.  It also avoids any potential issues we may have run into with the music conflicting with the sound effects.

I have not yet run out of space in the first ROM page, but my "compiler" thing does not support / is not aware of multiple pages.  I'm sure I will go onto the next page when I least expect and have no idea why everything is screwing up...  But I'll cross that bridge when I get there.

Nestopia audio recording:
https://sites.google.com/site/benboldt2/files/battle_nestopia.mp3 (https://sites.google.com/site/benboldt2/files/battle_nestopia.mp3)

ROM:
https://sites.google.com/site/benboldt2/files/ff_namcot_battle.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_battle.zip)

Edit:

I just found a big bug:

(http://i.imgur.com/dbU8IkY.png)

This means that I am playing my pulse channel 1 score on pulse channel 0 and not using pulse channel 1!  I am missing a whole channel and I can't wait to get home tonight and enable it to see what it sounds like!  :)  I thought it sounded like only 1 pulse channel...  Serves me right for entering it all at once and not listening incrementally along the way!

Edit:


I had edited this earlier, but maybe I only pressed preview and not save.  Here it is with both pulse channels.

New Nestopia audio recording:
https://sites.google.com/site/benboldt2/files/battle_nestopia_2.mp3

New ROM:
https://sites.google.com/site/benboldt2/files/ff_namcot_battle_2.zip
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on September 05, 2016, 01:07:21 am
The victory music is now done, and unfortunately this has put me onto the 2nd ROM page.  I removed the "character reordering screen" music to make this remain on the first page for now, so it is playable.  I will have to update my assembler / compiler program to be aware of this.

Audio recording:
https://sites.google.com/site/benboldt2/files/ff_namcot_victory_nestopia.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_victory_nestopia.mp3)

ROM:
https://sites.google.com/site/benboldt2/files/ff_namcot_victory.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_victory.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Disch on September 05, 2016, 01:49:49 am
Very cool!  I'm glad to see you're still trucking away with this.  Sounds great so far!   :thumbsup:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on September 05, 2016, 08:50:22 pm
Thanks Disch.

I have updated my code to support multiple pages.  For each song, it does a dry run first to see how big the song is, then it will put it onto the first page that has enough room.  You can see this in action at offset 0x40010 of the ROM file.  Song 19 didn't fit on the first page, so it went to the next page.  Then songs 20 and 21 were small enough to fit on the first page, so they actually ended up before song 19.

I haven't done a whole lot of testing yet, but it seems to be working pretty well.  It should theoretically support all 8 8kb pages.  This now requires a new command at the end of each score file: "parse!".  That simplifies things for me.  In fact it still has the bug where you need a line break at the end of each score file.  ::)

https://sites.google.com/site/benboldt2/files/multiple_page_support.zip (https://sites.google.com/site/benboldt2/files/multiple_page_support.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on October 12, 2016, 12:27:05 am
I have a small update, just to let you guys know I haven't forgotten this.

https://sites.google.com/site/benboldt2/files/ff_namcot_treasure_chest.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_treasure_chest.zip)

This has added snare drum and some other slight modification to the victory music, and also adds the treasure chest sound effect.  This sound effect is very similar to the original, with an echo added.  The game will no longer lock up when you open a treasure chest now.

Edit:


I have the Death music done now:

https://sites.google.com/site/benboldt2/files/ff_namcot_death.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_death.mp3)

https://sites.google.com/site/benboldt2/files/ff_namcot_death.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_death.zip)

Edit:


It looks like the "open treasure chest" song only works on the first page!  This is broken in the zip file above.  Next time I add a song it will be fixed.

Edit:


It also looks like the player ordering screen music must be on the first page, so I put that one on the first page too.  To do this, I have the shell script put them before the others.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on October 20, 2016, 09:44:25 pm
Special Item music is done:

Audio:
https://sites.google.com/site/benboldt2/files/ff_namcot_special_item.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_special_item.mp3)

Source & Bin:
https://sites.google.com/site/benboldt2/files/ff_namcot_special_item.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_special_item.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Duke2go on November 03, 2016, 11:03:44 pm
Disch directed me over here from the Reconstructed thread (and yes, that project is actually nearing completion finally). I'm thoroughly impressed with what I've seen of the work y'all have done and I pm'd Ben about some possible assistance. I'm definitely going to look through this thread more when I have some time. So impressed with the work that's been done while I've been away in the Final Fantasy hacking community as a whole.  :beer:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on November 04, 2016, 12:34:51 am
Disch directed me over here from the Reconstructed thread (and yes, that project is actually nearing completion finally). I'm thoroughly impressed with what I've seen of the work y'all have done and I pm'd Ben about some possible assistance. I'm definitely going to look through this thread more when I have some time. So impressed with the work that's been done while I've been away in the Final Fantasy hacking community as a whole.  :beer:
PM Sent.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Duke2go on November 04, 2016, 01:03:33 am
PM Sent.

And response as well my friend  :beer:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on November 06, 2016, 12:12:07 pm
I think that you should start a new topic for this and at the beginning of that topic, you should provide a step outline of the entire game's story.  This should include lots of screenshots from the game and brief descriptions of the storyline and the emotions felt at each step.  This will allow me and potentially others to style the music to the big picture and use the appropriate amount of depth and dynamic at the right times.

This outline may also help point out areas where you could tweak your storyline and graphics to work better with the big picture too.  It is so easy with these sorts of things to get stuck in the details and make every part to the extreme, when you could have strengthened important parts by dialing back something less important.  Etc.  maybe you have already done all of this, but if you haven't it will help us pull everything together and get other potential developers all on the same page.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Duke2go on November 06, 2016, 03:52:10 pm
I think that you should start a new topic for this and at the beginning of that topic, you should provide a step outline of the entire game's story.  This should include lots of screenshots from the game and brief descriptions of the storyline and the emotions felt at each step.  This will allow me and potentially others to style the music to the big picture and use the appropriate amount of depth and dynamic at the right times.

This outline may also help point out areas where you could tweak your storyline and graphics to work better with the big picture too.  It is so easy with these sorts of things to get stuck in the details and make every part to the extreme, when you could have strengthened important parts by dialing back something less important.  Etc.  maybe you have already done all of this, but if you haven't it will help us pull everything together and get other potential developers all on the same page.

That is an excellent idea my friend. When I was thinking of remaking the strategy guide, I wanted to include basically a written "story" in the guide to describe the game as the player's progressed. Sounds similar to what you're suggesting. I think I'll need to finish the script revisions completely first though so that won't be altered any further. If you have time I would be interested in discussing the changes in the story that I'm working on.  :beer:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on January 08, 2017, 12:05:59 pm
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!

https://sites.google.com/site/benboldt2/files/opening%20theme%201.mp3 (https://sites.google.com/site/benboldt2/files/opening%20theme%201.mp3)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Duke2go on February 11, 2017, 07:14:33 am
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:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on February 23, 2017, 01:01:28 am
I have an update!  The opening theme is pretty much done, I am very happy with it:

https://sites.google.com/site/benboldt2/files/opening_theme.mp3 (https://sites.google.com/site/benboldt2/files/opening_theme.mp3)

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:
https://sites.google.com/site/benboldt2/files/opening_theme_files.zip (https://sites.google.com/site/benboldt2/files/opening_theme_files.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on March 04, 2017, 08:10:21 pm
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:

https://sites.google.com/site/benboldt2/files/ff_namcot_shop_logic.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_shop_logic.mp3)


Edit:

I got it into the ROM now!

Audio recording form Nestopia:
https://sites.google.com/site/benboldt2/files/ff_namcot_shop_nestopia.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_shop_nestopia.mp3)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_shop_files.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_shop_files.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 22, 2017, 12:33:24 am
UPDATE!!

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

https://sites.google.com/site/benboldt2/files/ship_logic_1.mp3 (https://sites.google.com/site/benboldt2/files/ship_logic_1.mp3)

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):
Code: [Select]
+ 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

EDIT:

I got the ship music done now.

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_ship.zip?attredirects=0&d=1 (https://sites.google.com/site/benboldt2/files/ff_namcot_ship.zip?attredirects=0&d=1)

Ship Music on actual ship (percussion wiped out by water sound effect...):
https://sites.google.com/site/benboldt2/files/ff_namcot_ship.mp3?attredirects=0&d=1 (https://sites.google.com/site/benboldt2/files/ff_namcot_ship.mp3?attredirects=0&d=1)

Ship Music with percussion as intended:
https://sites.google.com/site/benboldt2/files/ff_namcot_ship_without%20_water.mp3?attredirects=0&d=1 (https://sites.google.com/site/benboldt2/files/ff_namcot_ship_without%20_water.mp3?attredirects=0&d=1)
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on October 22, 2017, 02:28:26 am
Finally an update!

Matoya's Theme is done now.

Video:
https://youtu.be/xDoLP_0qUus (https://youtu.be/xDoLP_0qUus)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_matoya.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_matoya.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on October 23, 2017, 03:35:48 am
Finally an update!

Matoya's Theme is done now.

Video:
https://youtu.be/xDoLP_0qUus (https://youtu.be/xDoLP_0qUus)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_matoya.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_matoya.zip)
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?
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on October 26, 2017, 08:23:31 pm
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!
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on October 30, 2017, 04:22:54 am
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? https://sourceforge.net/p/fceultra/bugs/ 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.
https://mega.nz/#!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.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on October 31, 2017, 12:44:14 am
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:

(https://i.imgur.com/r232QjZ.png)

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.
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on November 02, 2017, 02:24:59 am
I used these gamesaves: http://fantasyanime.com/finalfantasy/ff/ffsaves.htm
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 (https://github.com/Insidious611/DancingMadFF6/releases - 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?
Code: [Select]
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:
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on November 02, 2017, 10:34:00 pm
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.

Code: [Select]
+ 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"
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on November 05, 2017, 05:12:56 am
https://mega.nz/#F!nN53URiA!wtj-5Lfg0V1kxckTVCYDaA

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).
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on November 06, 2017, 09:00:28 pm
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.
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on November 07, 2017, 10:19:52 pm
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.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on November 14, 2017, 11:34:12 pm
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.

Video:
https://youtu.be/P_NwAGQgWPs (https://youtu.be/P_NwAGQgWPs)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_ship.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_ship.zip)

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.
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on November 15, 2017, 01:13:50 am
Old ship song renamed to ff_namcot_ship_v1, and added the new ff_namcot_ship_v2.
https://mega.nz/#F!nN53URiA!wtj-5Lfg0V1kxckTVCYDaA
And your Youtube link doesn't work. "Video is unavailable" message.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on November 16, 2017, 09:01:41 pm
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?
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on November 19, 2017, 02:11:29 pm
Do 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.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on December 09, 2017, 01:30:07 am
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.

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_potion.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_potion.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on December 11, 2017, 01:24:13 am
https://mega.nz/#F!nN53URiA!wtj-5Lfg0V1kxckTVCYDaA

Loop points found, edited, and uploaded.

Matoya's Cave and Menu Screen v2's up, previous ones renamed to v1, and Potion (non-looping) added as well.


For menu screen, the improv part itself is good, but the transition into it is rather jarring, and makes it feel like it doesn't belong. I think you need another few notes at the beginning of the improvised part, to better handle the transition into it. Transitions out of it fine.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on December 11, 2017, 07:36:16 pm
I added a few notes, let me know what you think of this and any other recommendations, or even if you like it better to be more true to the original without this extra part.

https://sites.google.com/site/benboldt2/files/ff_namcot_menu_v3.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_menu_v3.mp3)

Edit:
Honestly, I do think I will stick with the original without any of this extra stuff.  It has not turned out at all the way that I expected.

I'm not sure what I felt when I did the modification to the menu music; I think mostly I was just plugging in notes, and that's pretty much what it ended up sounding like.

If you or anyone have any ideas or example remixes of this song that make more sense, please let me know!
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on December 12, 2017, 06:13:30 am
That actually fixed the problem, sounds like a much more natural progression into the improv part.

I did some looking around, but it doesn't look like anyone's really done any remasters or remixes of Menu Screen...

Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on January 27, 2018, 06:13:52 pm
Progress update on Dungeon:

https://sites.google.com/site/benboldt2/files/ff_namcot_dungeon_progress_1.mp3

This is a hard one.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on February 11, 2018, 02:52:07 pm
I think I have dungeon done now:

Video:
https://youtu.be/ZIDmL-Y3vtk (https://youtu.be/ZIDmL-Y3vtk)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_dungeon.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_dungeon.zip)

I used the triangle channel in an interesting way in this song.
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on March 15, 2018, 08:36:20 am
Wow, I'd forgotten about this, lol (sorry).

Give me a day or two and I'll convert the new track like I did the other ones.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on March 18, 2018, 12:58:05 pm
Thanks edale.  There is an extra part in this song in Final Fantasy Origins that I did not do, it is mostly kind of an extra drum solo right where it loops.  I really like that and I may still try to add it.  Also, something just sounds a little off in the snare drum near the end, I just can't put my finger on it.  It seems like the last part is a little bit late and not lining up or something.  So it is possible there will be a newer version of this song at some point.

Edit


Improvement!

Video:
https://youtu.be/fJgGvajrtaM (https://youtu.be/fJgGvajrtaM)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_dungeon_v2.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_dungeon_v2.zip)
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on March 25, 2018, 04:10:25 am
I'd say I have no excuse, but I have several, lol. I've been playing the hell out of FFXV PC recently, and I just got a PSTV (if you don't know what it is look it up, cool little game system, basically a stripped down PSVita as a console, official Sony product, not a hack), and no sooner have I got the mod for that working and everything running good that the 3.65 CFW is released (literally 2 days after I got my system), which massively expands the list of Vita games I can play on the system, including Ys VIII, the game I got the system for (which I couldn't play before the CFW was updated, which would have sucked), so I've been playing a few games on that as well.

I also figured out how to record gameplay video in 720p/60 so I could upload some gameplay video of the FFVI MSU-1 mod I've been doing the audio work on, and recorded and uploaded all of the different versions of the Opera I've converted for the mod to Youtube. (http://www.romhacking.net/forum/index.php?topic=16476.msg353880#msg353880)

So i finally get to this, just finish uploading it, go to post... and I see the updated version, lol.

https://mega.nz/#F!nN53URiA!wtj-5Lfg0V1kxckTVCYDaA
Both V1 and V2 of Dungeon are done.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on March 26, 2018, 12:48:04 am
Thanks edale.  I have still not done the save music...  That should be pretty quick and easy.  Do you have a preference which full song I should do next?  It is down to these 4 now!

3. Ending Theme
6. Airship
13. Floating Castle
14. Future Chaos' Temple
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on March 26, 2018, 03:52:32 am
No preference, you're really that close to finishing the mod? Nice.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on March 31, 2018, 04:28:54 pm
Yes I am getting close but I have saved all the hardest stuff for last!  Floating castle will probably be the hardest I think.  Also, I really do need to improve or redo gurgu volcano.  That may be the very last thing I do since there is already something there for now.
Title: Re: Are there any Namco-163 hacks out there?
Post by: edale on April 01, 2018, 02:24:55 am
I know what that's like. You do something, think you did a great job, then a few days later you go over it again, and find TONS of obvious mistakes that you can't figure out how you missed the first time... But oh well, work on it later, there's at least something there, and there's several other tracks to work on...

Yea, lets just say my first few revisions of the Opera for the FFVI MSU-1 mod weren't as good as I originally thought, lol.
Title: Re: Are there any Namco-163 hacks out there?
Post by: Ben Boldt on June 23, 2018, 11:06:09 pm
Oh my, I got the 60+ days old warning when making this post......  This is a pretty slow-going project.  Slowly but surely!

I got Underwater Temple ("future chaos temple") done today!

MP3:
https://sites.google.com/site/benboldt2/files/ff_namcot_underwater_temple_nestopia.mp3 (https://sites.google.com/site/benboldt2/files/ff_namcot_underwater_temple_nestopia.mp3)

Files:
https://sites.google.com/site/benboldt2/files/ff_namcot_underwater_temple.zip (https://sites.google.com/site/benboldt2/files/ff_namcot_underwater_temple.zip)

You can use this Game Genie code to start the game with the new music:
TGXZTZPK

These are the only ones left to do now:
3. Ending Theme
6. Airship
13. Floating Castle
14. Future Chaos' Temple