Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /storage/content/49/145849/famitracker.com/public_html/forum/classes/dbHandler.php on line 29
_______________________
Follow me on [url=https://twitter.com/jrlepage2a03]Twitter.
I record (some) NSFs on hardware. Feel free to [url=http://www.famitracker.com/forum/posts.php?id=3633]request a hardware render.
One reason is that it's not easy to create triangle waves with controllable volume, compared to pulse or noise waves where it's inherently simple.
For triangle waves, it would be necessary do a multiplication or have a large lookup table to control the volume, which there clearly wasn't room for since the APU shared die with the CPU.
The NES triangle wave channel is actually a modified square channel. As you should know, the square channels have only 16 levels of volume. What the triangle channel does to get the triangle waveform is rapidly modulate this volume level so that the waveform slopes up and down. Since the channel's volume function is tied up in doing this, it isn't available for making the sound louder or quieter.
Fun Fact: on early revisions of the 2A03, (and rarely on some later ones), pin 30 is a test pin and one of the features is (EDIT: CRUDE) triangle "volume control" (PCM style).
_______________________
[BURNING LOVE]
[url=http://www.youtube.com/user/ImATrackMan]YouTube
[url=https://twitter.com/ImATrackMan]Twitter (Stay off my lawn, kids)
[quote=] In laymans terms, it allows for 4-bit PCM on the triangle channel.[/quote]
Aww man! Why they do that to us!
But PCM on Triangle using 16 volume steps.
Nah we should 'rape' the DPCM with 7-Bit Samples.
That's all revisions, so far as I understand, IaTM. What's your source for it being specific revisions? (I thought there was only one very early revision to the mask, to fix periodic noise.) Also it's a phase control for triangle, not volume, and outputting PCM on it would only be an academic exercise, not useful for much in particular. You can output 4-bit PCM on the squares already, without having to mod your NES.
Anyhow, it comes down to a number of issues. To digitally accomplish volume control, you need to multiply the signal by the volume, and the fine ability to control that output is dependent on the bits in your DAC. Multiplying digitally is not a trivial operation; often an analog operation like PWM is used instead, but not in the 2A03, it's all digital.
The square waves are just a 1 bit signal to start with, so its volume control is very simple, it either sends 0 or the volume to the DAC. It's a 5-bit DAC that just adds the two square channels. (Two 4-bit squares add together to make a 5-bit signal.)
The triangle, however, is a 4-bit signal to start with. If you wanted to control its volume digitally, you'd need a true multiplier, a wider DAC, or possible you'd need to put it on its own DAC fed through a PWM volume modulator, etc. this gets a bit complicated.
The triangle, noise, and DPCM unit share an output, I'm not sure how they are specifically combined, though. There's a funky formula for how they interact.
[quote=rainwarrior]The two squares together share a 5-bit DAC.
The triangle, noise, and DPCM unit share an output, I'm not sure how they are specifically combined, though. There's a funky formula for how they interact.[/quote]
Actually this reminded me of some interesting thing I heard long ago... is it possible to get expansion audio on a stock NES by taking the samples from the expansion chip and writing to $4011 in RAW PCM fashion? MMC5 should work this way... actually, FDS as well. VRC6, I'm not sure, I don't know the bit-depth of the final output signal...
If you design a custom expansion chip of your own, one that's designed to make it easy to pull samples from the chip and poke them into $4011, you can do it this way at somewhere around 8 kHz using about 20% of the CPU (IIRC). The way this is done is using the instruction "INC $4011". The idea is you design the mapper so that a read from $4011 will fetch the sample off the chip and immediately write back to $4011, all in six cycles. (Due to the way the NES works, the read will go to the cartridge, but the write will go to the APU.) Though since it is an INC instruction, you may want the chip to produce a decremented sample, so that the INC will re-increment it to the correct value.