nesdev.com
https://forums.nesdev.com/

MMC5 audio polarity
https://forums.nesdev.com/viewtopic.php?f=3&t=11432
Page 1 of 1

Author:  James [ Mon Jul 14, 2014 10:10 am ]
Post subject:  MMC5 audio polarity

The MMC5 audio page on the wiki states that "the polarity of all MMC5 channels is reversed compared to the APU."

What does that mean, exactly? Should the 0s and 1s in the APU's duty cycle sequences be swapped?

Code:
Duty    Waveform sequence
0   0 1 0 0 0 0 0 0 (12.5%)
1   0 1 1 0 0 0 0 0 (25%)
2   0 1 1 1 1 0 0 0 (50%)
3   1 0 0 1 1 1 1 1 (25% negated)

Author:  rainwarrior [ Mon Jul 14, 2014 10:17 am ]
Post subject:  Re: MMC5 audio polarity

It means that if the NES squares produce a positive voltage on a "1", the MMC5 squares doing the equivalent thing will produce a negative voltage.

I would suggest inverting the output. Don't make changes to the internal digital logic before output. Simply exchanging 1 and 0 is not the right idea, as remember this squares also have a volume control. 0 should still output 0, and this makes a difference especially if you are simulating an analog filter on the output. If you could replace 1 with -1, that would be conceptually more like what you want, but it would only be the correct implementation if you are multiplying it with the volume and not using some boolean logic on the volume.

Author:  James [ Mon Jul 14, 2014 10:26 am ]
Post subject:  Re: MMC5 audio polarity

So the MMC5 is actually outputting a negative voltage?

Author:  tepples [ Mon Jul 14, 2014 10:44 am ]
Post subject:  Re: MMC5 audio polarity

Yes. If your resampler can handle only unsigned signals, try subtracting the MMC5's output from 30.

Author:  James [ Mon Jul 14, 2014 11:05 am ]
Post subject:  Re: MMC5 audio polarity

Signed signals aren't a problem; I'll give it a try. Thanks, guys.

Author:  James [ Tue Jul 15, 2014 7:30 am ]
Post subject:  Re: MMC5 audio polarity

This seems to work fine, but I have a couple of (maybe dumb) questions:
- Where is the MMC5's negative voltage source?
- Why doesn't this cause issues? For example, wouldn't similarly setup square waves on the APU and MMC5 cancel each other out?

tepples wrote:
try subtracting the MMC5's output from 30.

That's inverting the signal, though, not generating a negative signal...

Author:  tepples [ Tue Jul 15, 2014 7:45 am ]
Post subject:  Re: MMC5 audio polarity

James wrote:
- Why doesn't [MMC3's inverted waveform] cause issues? For example, wouldn't similarly setup square waves on the APU and MMC5 cancel each other out?

They might cancel if they're exactly in phase, just as a 2A03 pulse wave with duty cycle $40 (1/4) and one with duty cycle $C0 (3/4) cancel. But in practice, such waves are rarely exactly in phase because they're playing different notes in the first place.

Quote:
That's inverting the signal, though, not generating a negative signal

There's no audible difference between the two.

Author:  rainwarrior [ Tue Jul 15, 2014 8:03 am ]
Post subject:  Re: MMC5 audio polarity

James wrote:
- Where is the MMC5's negative voltage source?
That's inverting the signal, though, not generating a negative signal...


Voltage isn't absolute, it's a relative difference. Whatever the baseline output of the 2A03 or MMC5 is, there is a highpass filter which shifts that baseline to ground (0). It doesn't need a negative voltage source, it only needs to go negative relative to its baseline output. Inverting and negating are the same thing in this situation.

Author:  James [ Tue Jul 15, 2014 8:26 am ]
Post subject:  Re: MMC5 audio polarity

ok -- I think I get it now. What you're saying is that, pre-highpass filter, whether the signal looks like this:
Code:
      2A03
      ----
     |    |
     |    |
0v --------------------
             |    |
             |    |
              ----
              MMC5

or this:
Code:
      2A03
      ----
     |    |
     |    |
   --      --      ----
             |    |
             |    |
              ----
              MMC5

0v --------------------


the output post-highpass is the same. Right?

Author:  rainwarrior [ Tue Jul 15, 2014 8:59 am ]
Post subject:  Re: MMC5 audio polarity

Yes, that is correct.

It's standard for a lot of audio devices to include a mild highpass filter to get rid of DC offset, because it can reduce amplifier headroom, cause inefficient use of power, or cause other problems for an audio system. You also can't hear a DC offset.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/