It is currently Mon Nov 20, 2017 12:58 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: MMC5 audio polarity
PostPosted: Mon Jul 14, 2014 10:10 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
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)

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Mon Jul 14, 2014 10:17 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5822
Location: Canada
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.


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Mon Jul 14, 2014 10:26 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
So the MMC5 is actually outputting a negative voltage?

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Mon Jul 14, 2014 10:44 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19233
Location: NE Indiana, USA (NTSC)
Yes. If your resampler can handle only unsigned signals, try subtracting the MMC5's output from 30.


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Mon Jul 14, 2014 11:05 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
Signed signals aren't a problem; I'll give it a try. Thanks, guys.

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Tue Jul 15, 2014 7:30 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
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...

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Tue Jul 15, 2014 7:45 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19233
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Tue Jul 15, 2014 8:03 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5822
Location: Canada
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.


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Tue Jul 15, 2014 8:26 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
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?

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: MMC5 audio polarity
PostPosted: Tue Jul 15, 2014 8:59 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5822
Location: Canada
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 13 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