Well for now I'm concerned about getting an authentic sound without worrying too much about emulating the specific operation of the hardware. I also want to add a few extras that the original didn't have, like vibrato, sweeping of the triangle channel, and maybe some other small odds and ends.
The pulse channel sound is simple to emulate, especially if you aren't concerned about timing their length & envelope data against other components, like the frame counter or interrupt lines. The triangle is a bit trickier to get authentic.
The noise channel is particularly difficult to emulate, at least for the inexperienced like me. The NES noise sound in itself is easy to reproduce as a sample using 4bit level quantized noise. The 2A03 actually uses a long shift register and a XOR gate to generate a new pseudo-random bitstream for noise samples. Rather than use my very own enveloping like I did for pulse and triangle channels, I will have to reproduce the native specs of the counters/timers and decay envelope modes, especially to get the looped-decay noise channel mode to sound authentic.
So I guess I will be using some of the same dataflow and control logic that the hardware uses, but I want to cut as many corners as I can right now, especially where I can easily provide userdata through the GUI instead of poking 6502 assembly. Then I can use my own, simpler methods for programmable manipulation of all of the inputs, but ideally get the same-sounding output as I would programming the actual hardware.
Right now I'm going through this document to try and get a full picture of the hardware:
http://nesdev.parodius.com/NESSOUND.txt
I believe that has everything needed to directly emulate the channels, I just gotta keep studying the hell out of it until I can determine all of the specifics on timing, mode switching, sample sizes and such.
The zenpho patch looks similar to what I want to use eventually for making real music, I'll probably refer to that a few times. I see he uses a completely diferent PWM routine than I do. Once I get the NES channels sounding properly, I plan to keep adding voices from other old sound chips I enjoy along with more extras and use it as my main synth.
Thanks alot for that headlessbarbie link. Really amazing stuff. I've had thoughts about later on trying to emulate the 2A03 hardware directly, so that I possibly could put pd on a board with a fast CPU (maybe a SuperH) that would be small enough to fit in a NES cart. Then I could use pd as just an interpreter between the user and the real live sound hardware.