$4011 vs MMC5 $5011 for PCM streaming?

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

Moderator: Moderators

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

$4011 vs MMC5 $5011 for PCM streaming?

Post by frantik » Thu Dec 10, 2020 2:09 pm

Taking a look at the MMC5 spec, I noticed among other useful features (like large window PRG-RAM banks) was an 8 bit PCM channel, similar to $4011, only with 8 bits vs $4011's 7 bits, and also with the ability to directly read from memory which looks like it may save a few clock cycles

Are there drawbacks to using MMC5 $5011? Does it require modding a powerpak for use? is it widely supported among emulators? Obviously using MMC5 would make it hard to put on a regular cart, though the RAM features alone are pretty appealing. Reading the wiki it sounds like this channel may not be as loud as 4011 anyways, or have some other issues when mixed with the main NES audio? Looking at the past forum topics, it seems like everyone feels $5011 has no advantage, but it seems like all things being equal, allowing twice as much dynamic range is still a fairly big advantage.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by lidnariq » Thu Dec 10, 2020 2:29 pm

frantik wrote:
Thu Dec 10, 2020 2:09 pm
Taking a look at the MMC5 spec, I noticed among other useful features (like large window PRG-RAM banks) was an 8 bit PCM channel, similar to $4011, only with 8 bits vs $4011's 7 bits, and also with the ability to directly read from memory which looks like it may save a few clock cycles
The auto-read is basically unusable, unfortunately. You have to somehow tickle a read from the relevant memory region only when you want to, and not otherwise, and at best you save 4cy on a write to $5011.

If they'd made it so that the 1KB of MMC5-internal RAM could have been used as a FIFO to it, that would have been a game-changer. Unfortunately, they didn't.
Are there drawbacks to using MMC5 $5011?
That the hardware assist isn't useful is pretty big in terms of actual games. You're basically constrained to using the MMC5 scanline IRQ, the DPCM IRQ, or timed code. (The MMC5A's cycle-timed IRQ wasn't documented until last year)

You're right that it's strictly better than $4011 in terms of raw streaming capabilities, especially in combination with not also serving as a volume control on the triangle and noise channels.
Does it require modding a powerpak for use?
Same as any other expansion audio.
is it widely supported among emulators?
The answer at least used to be "no" but that might have changed. Because it's so inconvenient to use, I think only one commercial game used it.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by frantik » Thu Dec 10, 2020 2:43 pm

lidnariq wrote:
Thu Dec 10, 2020 2:29 pm
frantik wrote:
Thu Dec 10, 2020 2:09 pm
Taking a look at the MMC5 spec, I noticed among other useful features (like large window PRG-RAM banks) was an 8 bit PCM channel, similar to $4011, only with 8 bits vs $4011's 7 bits, and also with the ability to directly read from memory which looks like it may save a few clock cycles
The auto-read is basically unusable, unfortunately. You have to somehow tickle a read from the relevant memory region only when you want to, and not otherwise, and at best you save 4cy on a write to $5011.

If they'd made it so that the 1KB of MMC5-internal RAM could have been used as a FIFO to it, that would have been a game-changer. Unfortunately, they didn't.
For my drum machine, I'm already dedicating a 16kb bank to samples, so reading from this area only during sample playback is no problem. And saving 4 clocks is actually useful when you've only got 81 total to work with. But it does seem like they could have implemented it in a better way
Are there drawbacks to using MMC5 $5011?
That the hardware assist isn't useful is pretty big in terms of actual games. You're basically constrained to using the MMC5 scanline IRQ, the DPCM IRQ, or timed code. (The MMC5A's cycle-timed IRQ wasn't documented until last year)

You're right that it's strictly better than $4011 in terms of raw streaming capabilities, especially in combination with not also serving as a volume control on the triangle and noise channels.
Does it require modding a powerpak for use?
Same as any other expansion audio.
is it widely supported among emulators?
The answer at least used to be "no" but that might have changed. Because it's so inconvenient to use, I think only one commercial game used it.
hmm I may have to give it a try sometime, though the powerpak modding and poor emulator support seem like turn offs. But especially if I get synths working in addition to samples, being able to use triangle without affecting volume would be cool. And even if i still use 4011, being able manipulate samples in RAM would be a very desirable feature of MMC5

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by rainwarrior » Thu Dec 10, 2020 2:58 pm

lidnariq wrote:
Thu Dec 10, 2020 2:29 pm
frantik wrote:
Thu Dec 10, 2020 2:09 pm
Does it require modding a powerpak for use?
Same as any other expansion audio.
...except no existing PowerPak MMC5 mapper implements it.
frantik wrote:
Thu Dec 10, 2020 2:09 pm
Looking at the past forum topics, it seems like everyone feels $5011 has no advantage, but it seems like all things being equal, allowing twice as much dynamic range is still a fairly big advantage.
I don't think the advantage is that large. Yes, it can go louder, but $4011 PCM isn't exactly suffering from being too quiet. Otherwise the difference in quality between 7-bit and 8-bit audio is negligible.

All things are not equal, for reasons already mentioned. Poor hardware support. Poor emulator support. Etc.
frantik wrote:
Thu Dec 10, 2020 2:43 pm
...being able to use triangle without affecting volume would be cool.
I agree that's a useful property.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by frantik » Thu Dec 10, 2020 3:10 pm

rainwarrior wrote:
Thu Dec 10, 2020 2:58 pm
...except no existing PowerPak MMC5 mapper implements it.
ah well then it's not really worth even bothering with if it can't easily be implemented on the real thing. And the volume being affected on the triangle can also be a good thing if it's desired...

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by rainwarrior » Thu Dec 10, 2020 3:14 pm

frantik wrote:
Thu Dec 10, 2020 2:43 pm
...being able manipulate samples in RAM would be a very desirable feature of MMC5
This is actually pretty significant. $5011 vs. $4011 completely aside, MMC5 probably has the best support of any mapper for large PRG-RAM.

Emulator support for that varies, but it's a good interface for it at least. I made a test ROM in case you want to investigate its viability.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by frantik » Thu Dec 10, 2020 3:42 pm

rainwarrior wrote:
Thu Dec 10, 2020 3:14 pm
frantik wrote:
Thu Dec 10, 2020 2:43 pm
...being able manipulate samples in RAM would be a very desirable feature of MMC5
This is actually pretty significant. $5011 vs. $4011 completely aside, MMC5 probably has the best support of any mapper for large PRG-RAM.

Emulator support for that varies, but it's a good interface for it at least. I made a test ROM in case you want to investigate its viability.
Thanks, I'll check out that test ROM. The huge ram bank windows of MMC5 would allow for some fun stuff like mixing two samples, reversing, volume manipulation, bit crushing, etc

User avatar
dougeff
Posts: 2821
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by dougeff » Thu Dec 10, 2020 3:42 pm

Everdrive N8 Pro (Famicom) supports MMC5 audio.
nesdoug.com -- blog/tutorial on programming for the NES

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by rainwarrior » Thu Dec 10, 2020 3:49 pm

Does it support MMC5 PCM or just the squares?

User avatar
dougeff
Posts: 2821
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by dougeff » Thu Dec 10, 2020 4:20 pm

I can't find any technical information. I don't own one. Maybe next year I will get one.
nesdoug.com -- blog/tutorial on programming for the NES

Pokun
Posts: 1753
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by Pokun » Fri Dec 11, 2020 11:22 am

I don't have the PRO either, but it looks like it was made open-source.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by rainwarrior » Fri Dec 11, 2020 1:15 pm

Seems to be code there for the PCM channel. That's nice at least, sounds like N8 Pro actually makes MMC5 PCM accessible.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by frantik » Fri Dec 11, 2020 2:18 pm

That is good to know at least it's feasible to get it working some real hardware

A crazy idea i had just now.. I wonder if you could output to both 4011 and 5011 and have it output an even louder signal.. maybe some kind of poorman's 16 bit? probably get some clipping somewhere i bet especially on emulators

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by lidnariq » Fri Dec 11, 2020 2:32 pm

We've floated that idea before, but the problem is that it'd probably require calibration on each individual console that it's used on.

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

Re: $4011 vs MMC5 $5011 for PCM streaming?

Post by rainwarrior » Fri Dec 11, 2020 2:51 pm

If you want to make it 50% louder, you can send the same value to both (inverted on one).

If you want to increase bit depth, if you could rely on MMC5 chips having a very consistent output volume (which you can't, but hypothetically if you could) I guess theoretically you could figure out a big table of all possible output levels and it'd have a few more bits of depth. "16-bit" is probably a massive stretch, I'd guess more like 9 or 10 at best. However, it's only hypothetical because this is actually impossible due to the inconsistency of both the 2A03 and MMC5 mixing.


However, if you want to produce extra bit fidelity, you could also jitter the values up and down in some sort of PWM/dither scheme, at the cost of a more dense output loop. (This is not an MMC5 specific idea, $4011 can do the same.)

I think someone proposed a method of playing DPCM samples while playing PCM to do fine manipulations like that, which is a method that might play nicely with an IRQ approach. I can't find the thread for that one at the moment though.

Edit: I think this was the DPCM + PCM method I was thinking of:
http://forums.nesdev.com/viewtopic.php?f=2&t=20014

Post Reply