About MMC5's 2 square channels

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

kuja killer
Posts: 112
Joined: Mon May 25, 2009 2:20 pm

About MMC5's 2 square channels

Post by kuja killer » Sun Dec 20, 2020 11:18 pm

Hello, I was wondering about something with the 2 square channels provided by MMC5 mapper. I have support for this in my game so music or sound can use them anytime. And so far i've only ever done it 1 single time with the Item Shop theme in my game. But there's something kind of weird I noticed that I dont quite understand.

Apparently these 2 squares are exactly the same as the regular NES 2 squares as mentioned on the nesdev wiki page, except a few differences.
reference:
http://wiki.nesdev.com/w/index.php/MMC5 ... .245003.29

But... something that page did not mention is that they seem to be louder than the normal squares. Why is that ?? or is that the meaning of one of those bullet points ? I've tested by playing square 1/2 channels normally ...then switched the pointers to the MMC5 ones only, and i can hear a very noticeable difference in the volume of the whole song. The MMC5 channels are like a couple "ticks" louder than the normal square's.

I checked the debugger just in case, and there is nothing wrong there. The same "volume" is writen to $4000 or $5000 reguardless.

Image

Whats the deal with this louder volume ?? It should really be explained in the wiki page. :(
or is it quote "polarity of all MMC5 channels is reversed compared to the APU" ??
i dont know what that phrase means.
Last edited by kuja killer on Mon Dec 21, 2020 4:42 am, edited 1 time in total.

lidnariq
Posts: 10260
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: About MMC5's 2 square channels

Post by lidnariq » Sun Dec 20, 2020 11:59 pm

Why do you think that FCEUX is emulating the volume accurately?

kuja killer
Posts: 112
Joined: Mon May 25, 2009 2:20 pm

Re: About MMC5's 2 square channels

Post by kuja killer » Mon Dec 21, 2020 4:36 am

i wasnt asking about the emu specifically. :| but uhhh, what do you mean ?? that fceux does it wrong ?

User avatar
Bregalad
Posts: 8008
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Re: About MMC5's 2 square channels

Post by Bregalad » Mon Dec 21, 2020 6:46 am

How loud expansion sound is, is a very complex topic ! It depends on the resistors on the cartridges, and, if you use a western NES with a modified adapter, how the NES and the adapter were modified to add extension sound.

Also even on original Famicom it will very from the very model of Famicom you use.

Various emulators have various strategies when it comes to emulating loudness of expansion sound.
Useless, lumbering half-wits don't scare us.

User avatar
tokumaru
Posts: 12000
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: About MMC5's 2 square channels

Post by tokumaru » Mon Dec 21, 2020 9:40 am

FCEUX is not a particularly accurate emulator overall, but even if that wasn't the case, you generally shouldn't take things you observe in emulators as facts. Expansion audio in particular is an aspect that can be affected by several factors, so unless you have a real MMC5 cartridge and a few different consoles to run tests on, it'll be hard to tell what the volume is actually like in real situations.

kuja killer
Posts: 112
Joined: Mon May 25, 2009 2:20 pm

Re: About MMC5's 2 square channels

Post by kuja killer » Mon Dec 21, 2020 10:21 am

huh i see. Yea i dont have an real nes/famicom or anything like that so i wouldn't know in person.

lidnariq
Posts: 10260
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: About MMC5's 2 square channels

Post by lidnariq » Mon Dec 21, 2020 12:25 pm

The other thing you asked about:
kuja killer wrote:
Sun Dec 20, 2020 11:18 pm
"polarity of all MMC5 channels is reversed compared to the APU" ??
i dont know what that phrase means.
Means that if you play the same pitch at the same time, at the same volume, and the same duty %, on both an internal and external pulse channel, that it will mysteriously be very quiet instead.

If you play almost the same pitch at the same time at the same volume etc, you will instead get something that sounds like the C64 SID "phasing"/"PWM" sound.

User avatar
rainwarrior
Posts: 8004
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: About MMC5's 2 square channels

Post by rainwarrior » Mon Dec 21, 2020 3:07 pm

kuja killer wrote:
Sun Dec 20, 2020 11:18 pm
But... something that page did not mention is that they seem to be louder than the normal squares. Why is that ??
Because they're not louder, on any MMC5 cartridge I've measured. However, the parts used aren't exactly high precision, and I'm sure some MMC5 carts are a little louder or a little quieter than others.

If you're talking about a cartridge you have, I'd love an extra point of data to consider, but if you're just asking about an emulator I think lidnariq already made the point that your question is really about the emulator not the MMC5.
kuja killer wrote:
Sun Dec 20, 2020 11:18 pm
or is it quote "polarity of all MMC5 channels is reversed compared to the APU" ??
i dont know what that phrase means.
Just means that they're inverted. Upside down. If you use the narrow pulse on the 2A03, the narrow part sticks "up" in voltage. On the MMC5 the narrow part sticks "down".

User avatar
tokumaru
Posts: 12000
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: About MMC5's 2 square channels

Post by tokumaru » Mon Dec 21, 2020 5:26 pm

rainwarrior wrote:
Mon Dec 21, 2020 3:07 pm
Just means that they're inverted. Upside down. If you use the narrow pulse on the 2A03, the narrow part sticks "up" in voltage. On the MMC5 the narrow part sticks "down".
And if you generate similar sounds in sync (one channel "sticks up" as much as another "sticks down"), they cancel each other, resulting in silence.

kuja killer
Posts: 112
Joined: Mon May 25, 2009 2:20 pm

Re: About MMC5's 2 square channels

Post by kuja killer » Mon Dec 21, 2020 8:17 pm

rainwarrior wrote:
Mon Dec 21, 2020 3:07 pm
Because they're not louder, on any MMC5 cartridge I've measured. However, the parts used aren't exactly high precision, and I'm sure some MMC5 carts are a little louder or a little quieter than others.

If you're talking about a cartridge you have, I'd love an extra point of data to consider, but if you're just asking about an emulator I think lidnariq already made the point that your question is really about the emulator not the MMC5.
Oh okay. didn't know. well again i wasn't meaning to actually ask about fceux specifically. It just is the main one i use to develop my megaman romhack with since day 1, and i was kinda concerned why it seemed those MMC5 squares were playing louder for some reason than the normal squares. I didnt ever mess with the sound settings or anything like that, on the emu.

So guess it's just fceux the problem itself then. Did not know. :( And as i said i dont own a NES or any carts or anything. so i cant test my game in real-life. I wish i could though

User avatar
rainwarrior
Posts: 8004
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: About MMC5's 2 square channels

Post by rainwarrior » Mon Dec 21, 2020 9:09 pm

FWIW if you actually built your own famicom carts for this, you could set the mix balance however you want with the resistors placed on the board.

frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Re: About MMC5's 2 square channels

Post by frantik » Wed Dec 23, 2020 4:32 am

kuja killer wrote:
Mon Dec 21, 2020 8:17 pm
So guess it's just fceux the problem itself then. Did not know. :( And as i said i dont own a NES or any carts or anything. so i cant test my game in real-life. I wish i could though
try it in a variety of emus and see what happens. Even if the target is real NES hardware, most stuff gets run on emulators more anyways. If it sounds good in other emulators it might just be a fluke with FCEUX

User avatar
Ben Boldt
Posts: 754
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: About MMC5's 2 square channels

Post by Ben Boldt » Thu Dec 24, 2020 2:59 pm

lidnariq wrote:
Mon Dec 21, 2020 12:25 pm
Means that if you play the same pitch at the same time, at the same volume, and the same duty %, on both an internal and external pulse channel, that it will mysteriously be very quiet instead.
The internal and MMC5 pulse channels should stay in sync because they are both derived from the CPU clock. Do we know if the phase offset between the 2 is predictable? They restart their phase when the most significant part of the frequency is written to like the internal ones I think, don't they?

I have also wondered a similar thing along these lines. With the internal pulse channels, care must be taken not to write to the most significant frequency bits during vibratos because it will reset the phase at each write, creating an undesirable artifact. The workaround involves using the sweep register to change the most significant part without resetting the phase.

Since the MMC5 appears to have zero support for sweep, I am wondering, do we know for sure that the MMC5 restart the phase like that? And if so, is there therefore no known workaround for vibrato artifacts?

lidnariq
Posts: 10260
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: About MMC5's 2 square channels

Post by lidnariq » Thu Dec 24, 2020 3:27 pm

Ben Boldt wrote:
Thu Dec 24, 2020 2:59 pm
Do we know if the phase offset between the [2A03 and MMC5 pulse channels] is predictable? They restart their phase when the most significant part of the frequency is written to like the internal ones I think, don't they?
Pedantically predictable, yes, but quickly out of scope for the 2A03. You can take advantage of the phase reset to put them at a known phase alignment using timed code.

Musically, however, I've never heard anyone deliberately use cancellation, as opposed to the "subtly out of tune" PWM sound.
Since the MMC5 appears to have zero support for sweep, I am wondering, do we know for sure that the MMC5 restart the phase like that? And if so, is there therefore no known workaround for vibrato artifacts?
I believe the wiki is Rainwarrior's notes, so I trust them completely.

User avatar
rainwarrior
Posts: 8004
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: About MMC5's 2 square channels

Post by rainwarrior » Thu Dec 24, 2020 3:28 pm

Yes, the MMC5 resets phase with the register that writes the high bits of period. This is explicitly mentioned on the wiki.

No, there's no sweep workaround with no sweep unit available.

Post Reply