From
the wiki:
Quote:
At maximum volume, the pulse channels of the VRC6 are roughly equivalent to the pulse channels of the 2A03 (except inverted). The DAC of the VRC6, unlike the 2A03, appears to be linear.
The final mix is a 6-bit DAC summing the two 4-bit pulse outputs and the high 5 bits of the saw accumulator.
I'm confused how to mix the 5-bit output with the
other channels. Should I be doing something like this:
Code:
95.88
pulse_out = --------------------------------------------------------------------------------------
(8128 / (apu_pulse1 + apu_pulse2 + vrc6_pulse1 + vrc6_pulse2 + vrc6_sawtooth)) + 100
No. The VRC6 is mixed independently of the APU and it is linear. Don't include it in the APU's nonlinear mix.
Linear mix = addition.
The overall level of the VRC6 is roughly so that its pulse at full strength is equivalent in volume to an APU pulse at full strength.
Code:
apu_mix = ... ; // you've got some formula for this already
const VRC6_SCALE = APU_PULSE_STRENGTH / 15;
vrc6_mix = (vrc6_pulse1 + vrc6_pulse2 + vrc6_sawtooth) * VRC6_SCALE;
output = apu_mix + vrc6_mix;
You can calculate APU_PULSE_STRENGTH by plugging a full-on pulse into your APU mixing formula.
The wiki mentions that the signal is inverted? What does that mean?
A lot of synthesizers in Famicom mappers are configured with opposite polarity compared to the 2A03's APU. For example, a tone on the 2A03 might produce levels 0, 8, 0, 8, 0, ... while an equivalent tone on a mapper synth might produce 0, -8, 0, -8, 0. Normally this 180 degree phase difference is inaudible unless you try to play the same tone on the 2A03 and the mapper synth at the same time.
In your code, though, you can invert the output just by putting a - in front of the scale constant.
Inverted relative to the APU means that if the APU outputs a pulse as a short positive voltage then a long negative one (relatively), the equivalent thing on VRC6's pulse would be a short negative voltage then a long positive one.
As tepples pointed out, it doesn't make a difference in what you hear, but it is a technical difference in the signal that can be measured.
Calling it a 180 degree phase difference may seem kind of strange, depending on how you think of it, but it's technically correct in the frequency domain. An inversion of a periodic signal in the frequency domain is a 180 degree phase difference. In the signal domain, though, it's not except in the case of a symmetrical signal like a 50% square or triangle.
Thanks rainwarrior and tepples. Those suggestions worked quite well.