It is currently Sun Oct 22, 2017 6:34 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: NSF player "cheats"?
PostPosted: Wed Jan 20, 2016 9:13 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
I'm quite happy with the accuracy of my NSF player by now, so I've started looking for ways to (optionally) fudge things to improve sound quality beyond actual hardware. So far I've tried four different hacks, with varying degrees of success:

N163 overclocking
The obvious brute-force solution to the ringing and aliasing this chip produces. Examples: any N163 game. Downsides: none.

Halt APU triangle on periods 0 and 1
Gets rid of the popping sound when the triangle is "muted" by setting it to an ultrasonic frequency. Examples: Mega Man 2. Downsides: none.

APU pulse DC removal
Reduces the crackle that occurs whenever a pulse channel's level changes. Examples: Kid Icarus, The Legend of Zelda, Dr. Mario.
Downsides: causes a low-frequency buzz on some tunes (Mega Man 2 NSF track 13, Dr. Mario NSF track 12). Probably a bug in my implementation, though I can't seem to figure out where.

APU pulse linear mixing
Fixes the crossmodulation artifacts on some games - mostly FDS titles, for some reason. Examples: Kid Icarus, Doki Doki Panic.
Downsides: alters balance slightly, and some games seem to do it on purpose, like the metallic pings in Solstice.

Does anyone have anything else to add to the list?


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Thu Jan 21, 2016 6:17 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19115
Location: NE Indiana, USA (NTSC)
Rahsennor wrote:
APU pulse DC removal
Reduces the crackle that occurs whenever a pulse channel's level changes. Examples: Kid Icarus, The Legend of Zelda, Dr. Mario.
Downsides: causes a low-frequency buzz on some tunes (Mega Man 2 NSF track 13, Dr. Mario NSF track 12). Probably a bug in my implementation, though I can't seem to figure out where.

That'll cause my early "Hello" demo to fail to produce any audio. It writes to the volume register as if it were a primitive form of $4011.


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Thu Jan 21, 2016 8:10 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3943
Can't you constantly reset the phase to make the raw square waves sound better?

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Thu Jan 21, 2016 5:23 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
tepples wrote:
That'll cause my early "Hello" demo to fail to produce any audio. It writes to the volume register as if it were a primitive form of $4011.

I just tested it, and it still works. The third amplitude modulation sample sounds rather thin though.

I suppose that just proves my implementation is indeed buggy and explains that suspicously 60hz-sounding buzz on some tracks. It does reduce the crackle, though, so it's not a total failure.


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Wed Jan 27, 2016 5:38 am 
Offline
User avatar

Joined: Fri Jan 24, 2014 9:05 am
Posts: 132
Location: Hungary
My suggestion would be an option to also silence the triangle at period $7FF because the sound engine used in games like Recca, Kickmaster, and Zombie Nation "silences" the triangle by writing $7FF to the period, which produces a noticable sustained "breathing" sound from the quantization steps of the wave. I don't know how common it is to silence the triangle with period $000 (the Follin engine does it as well, not only the first two Mega Man games), but $7FF is definitely less common.


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 9:29 am 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 540
NSF2 format support.

2a0x audio TEST register support.

Jaleco ADPCM expansion audio support.

Bandai Mitsubishi LPC decoder expansion audio support.

Arcade Dual-2a0x support (Donkey Kong 3).

DAC out mode of PPU signals for PPU generated audio.

Not really "cheats" but those are currently not supported...

Cheats:

User allocation of expansion audio channels to stereo mixer.

5B dynamic over/underclocking for envelope generator to simulate AY/YM.

VRC6 sawtooth waveform flip limiter glitch fix.

DMC memory wraparound glitch fix.


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 6:23 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
B00daW wrote:
NSF2 format support.

I thought that wasn't finished yet?

B00daW wrote:
Jaleco ADPCM expansion audio support.

Bandai Mitsubishi LPC decoder expansion audio support.

Not available in the NSF format, and I can't implement what I can't test anyway.

B00daW wrote:
2a0x audio TEST register support.

Arcade Dual-2a0x support (Donkey Kong 3).

DAC out mode of PPU signals for PPU generated audio.

Sorry, but I don't even know what you're talking about.

B00daW wrote:
User allocation of expansion audio channels to stereo mixer.

My player is monophonic, just like the hardware. It's on the to-do list, but I really don't feel like rewriting all my DSP just to add stereo output right now.

B00daW wrote:
5B dynamic over/underclocking for envelope generator to simulate AY/YM.

...how is that useful? A 5B is a 5B, and should do what a 5B does. Unless there's something that requires this behaviour?

(Besides, I haven't even implemented the envelope generator yet. :oops: Can't find test files.)

B00daW wrote:
VRC6 sawtooth waveform flip limiter glitch fix.

DMC memory wraparound glitch fix.

These sound like the sort of thing I had in mind, but I've never heard of them before. What exactly are they? Where can I find more info?


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 6:48 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5730
Location: Canada
Rahsennor wrote:
B00daW wrote:
VRC6 sawtooth waveform flip limiter glitch fix.
DMC memory wraparound glitch fix.

These sound like the sort of thing I had in mind, but I've never heard of them before. What exactly are they? Where can I find more info?

1. The VRC6's sawtooth accumulator wraps around if you set the volume too loud.
2. A DPCM sample length that goes past $FFFF wraps back around to $8000. ( edit: Sorry, slip of the memory. Corrected by TheFox below. )

I'm not sure what value there is in "cheating" these.

What exactly would a cheating DPCM address to? There's nowhere for the address to go past the end of memory, so I don't see any reason to do anything but the wrapping that the hardware actually does.

Similarly, all you'd get from "fixing" the VRC6 sawtooth is the ability to make it extra loud. (Extremely overpowered, really.) It would also break anything that relies on the wrap to produce different waveform timbres (Konami games don't do this, but modern NSFs might). I don't think anyone's out there saying the VRC6 sawtooth isn't loud enough?


Last edited by rainwarrior on Sat Jan 30, 2016 11:06 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 7:59 pm 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2963
Location: Tampere, Finland
rainwarrior wrote:
2. A DPCM sample length that goes past $FFFF wraps back around to $C000.

Hardware wraps to $8000.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 8:22 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6294
Location: Seattle
Rahsennor wrote:
Sorry, but I don't even know what you're talking about.
Explaining:
B00daW wrote:
2a0x audio TEST register support.
When we decap'ed the 2A03G, we discovered pulling pin 30 high made four new registers appear:
Reads from $4018: Return current value of APU pulse channel DACs
Reads from $4019: Return current value of APU triangle and noise channel DACs
Reads from $401A: Return contents of DMC DAC
Writes to $401A: Set triangle phase and "lock channel outputs", whatever that means.
See Quietust's comments: http://wiki.nesdev.com/w/index.php/File:Apu_address.jpg

B00daW wrote:
Arcade Dual-2a0x support (Donkey Kong 3).
Same as dual SID or dual AY, just two 2A03s. Does require two separate emulated CPUs.

The arcade DK3 was made before they figured out that DPCM DMA causes glitches when reading from the controller ports, so they did the "normal arcade thing" and added an extra CPU instead.

I can't (yet) tell you how the two CPUs communicate, but you can see if you can figure out mame's source more easily than I: src/mame/drivers/dkong.cpp


Similarly, adding support for dual-2A03 via the Vs. System communications methods might be interesting.

B00daW wrote:
DAC out mode of PPU signals for PPU generated audio.
I don't see how this is interesting? It's going to have an overwhelming loud 50/60Hz buzz on top of whatever intended signal is generated.


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 8:36 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19115
Location: NE Indiana, USA (NTSC)
lidnariq wrote:
B00daW wrote:
DAC out mode of PPU signals for PPU generated audio.
I don't see how this is interesting? It's going to have an overwhelming loud 50/60Hz buzz on top of whatever intended signal is generated.

mouser (video)


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 9:46 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6294
Location: Seattle
lidnariq wrote:
I can't (yet) tell you how the two CPUs communicate, but you can see if you can figure out mame's source more easily than I: src/mame/drivers/dkong.cpp
There's a Z80 host with four write-only ports at 0x7C00-0x7DFF:
* Z80 port at 0x7C00-0x7C7F is read by 2A03 coprocessor 1 via reads from $4016
* Z80 port at 0x7C80-0x7CFF is read by 2A03 coprocessor 1 via reads from $4017
* Z80 port at 0x7D00-0x7D7F is read by 2A03 coprocessor 2 via reads from $4016
* Z80 port at 0x7D80-0x7DFF ones bit drives both coprocessors' /RESET inputs

Both coprocessors have their own 512 byte RAM and 8 KiB ROM. Z80 Host has 32 KiB of ROM, 4 KiB of RAM, and 2 KiB of video RAM. I see no way for the coprocessors to tell the host anything.


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 10:51 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
rainwarrior wrote:
1. The VRC6's sawtooth accumulator wraps around if you set the volume too loud.
2. A DPCM sample length that goes past $FFFF wraps back around to $C000.

Those was the first things that came to mind, but I didn't see the point in 'fixing' them if that were the case.

I still don't, to be honest; the VRC6 saw is loud enough as it is and running the DMC over the interrupt vectors makes no sense in the first place.

lidnariq wrote:
When we decap'ed the 2A03G, we discovered pulling pin 30 high made four new registers appear:
Reads from $4018: Return current value of APU pulse channel DACs
Reads from $4019: Return current value of APU triangle and noise channel DACs
Reads from $401A: Return contents of DMC DAC
Writes to $401A: Set triangle phase and "lock channel outputs", whatever that means.

Interesting. I could add these registers to my emulator easily enough, but I'm not sure it would help anyone. I doubt many other emulators support them and it wouldn't even work on hardware without modifications. What use would it be? :?

za909 wrote:
My suggestion would be an option to also silence the triangle at period $7FF because the sound engine used in games like Recca, Kickmaster, and Zombie Nation "silences" the triangle by writing $7FF to the period, which produces a noticable sustained "breathing" sound from the quantization steps of the wave. I don't know how common it is to silence the triangle with period $000 (the Follin engine does it as well, not only the first two Mega Man games), but $7FF is definitely less common.

I didn't reply earlier, but thanks for this, it's just the sort of thing I was looking for.

Just to try and get the thread back on topic, what heuristics are people using to remove DMC clicks? What games are particularly notable for causing them?


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sat Jan 30, 2016 11:12 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5730
Location: Canada
Rahsennor wrote:
Just to try and get the thread back on topic, what heuristics are people using to remove DMC clicks? What games are particularly notable for causing them?

Many soundtracks by Konami tend to set the DMC counter at the start of every sample. Castlevania III, for example.

My click removal is to detect if $4011 is ever written; if so, I maintain an inverse signal that is mixed on top to cancel it out (i.e. the result of the $4011 write steps up the waveform +35, then my "inverse" jumps down -35). Over time I allow the inverted signal to slowly and noiselessly drain out back to 0 (which is important because clicks are often in 1 direction only, and could eventually cause integer overflow).


Top
 Profile  
 
 Post subject: Re: NSF player "cheats"?
PostPosted: Sun Jan 31, 2016 2:01 am 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 540
I didn't say the fixes were spectacular but may aid to some minor annoyances.

Every suggestion I said was for art. Regarding those glitches possibly to be fixed I've used them to create forms of art already.

All other suggestions are also purely art related. :) If you don't see a point, you may just not share a similar perspective. It seems that your perspective is to get cleaner sounds out of commercial music and games. Myself and many other people use older hardware and consoles to create art for expression.

http://average.truechiptilldeath.com/ne ... poc-02.nsf

Here is an example of using the triangle channel for FM and the DMC channel for AM that I made as a PoC.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group