Monday, October 16, 2017

NES Clones Reversed Duty Cycles - Why you should Reject them

Clones of the Famicom have been around since the mid-1980s, but clones of the Nintendo Entertainment System were very rare until Nintendo's patents expired in 2005.  Since then, clones have become quite common, all advertising such features as improved cartridge insertion mechanisms, lower cost (compared to the official NES top loader), x-in-1s with Genesis or SNES hardware and more recently built-in HDMI support.  However, the hardware in many of these clone consoles is fatally flawed and will not give a genuine experience.  The flaw comes in the reproduction of the NES's audio in the form of reversed duty cycles.  In this blog post, I will explain why this is an issue, how to detect it and why you should not buy second-rate clone consoles.




How the NES Generates Pulse Waves

The NES has five audio channels, two pulse waves, a triangle wave, a noise generator and a PCM channel.  We need to look at the pulse waves, the backbone of NES music and many of its sound effects.  In order to understand a pulse wave, we must look at the most basic waveform used in classic video games, the square wave.  A square wave is a signal that represents a nearly-instantaneous change in a logic level from high to low where the time the wave spends at both the high state and the low state is equal.  You can say that a square wave is 50% high or on and 50% low or off.  The proportion between high and low states is called the duty cycle, and because the length of time at each state is the same, the resulting wave is called a square wave.

The number of times a square wave transitions from high to low in one second is its frequency.  When a square wave is run through an amplifier, an audible sound can be heard if the frequency of the wave is within the range of human hearing.  So if a square wave is oscillating at 440Hz, you will hear a "middle C" note.

A pulse or a rectangle wave is a refinement of the square wave.  With a pulse wave, the high/low period need not be equal.  Control over the duty cycle allows for a different sound between a square wave and a rectangle wave.

The NES controls its audio through several 8-bit registers located within the CPU's memory.  The NES has two pulse wave channels and they each have a set of four registers to control their various functions.  One of those registers controls the duty cycle with two bits, giving four choices for duty cycles.

Duty Cycle Bits = 00 / Selection 0, Duty Cycle = 12.5%
 _
| |
| |
| |_______

Duty Cycle Bits = 01 / Selection 1, Duty Cycle = 25%
 __
|  |
|  |
|  |______

Duty Cycle Bits = 10 / Selection 2, Duty Cycle = 50% (aka a square wave)
 ____
|    |
|    |
|    |____

Duty Cycle Bits = 11 / Selection 3, Duty Cycle = 75% (aka 25% negated)
 ______
|      |
|      |
|      |__

Even though there are four actual choices, the 25% and 75% selections will sound identical.  So you are left with three functional choices where the sound will not be the same.

Here are recordings of how a 438.6Hz frequency will sound at each duty cycle.  First will come 12.5%, then 25%, then 50% and finally 75% and each tone will play for about 4.5 seconds.



Note how the square wave sounds more "hollow" than the rectangle waves.  The unequal waveforms sound more buzzier, especially the 12.5%, which almost sounds like a sawtooth wave.

The Differences between Proper and Reversed Duty Cycles with Samples

In clone consoles with reversed duty cycles, the pulse wave portions of the audio will often, but not always, sound incorrect.  In these consoles, duty cycle selections 1 and 2 are reversed.  When the music programmer intended select a square wave on an official console, you will hear the 25% duty cycle instead and vice-versa.  However, if the music programmer intended to use selections 0 or 3, then the music will play back as intended, so the duty cycle issue may not be instantly recognizable.

Here are recordings of how a 438.6Hz frequency will sound at each duty cycle on a clone console with reversed duty cycles.  First will come 12.5%, then 50%, then 25% and finally 75% and each tone will play for about 4.5 seconds.  This uses the same combination of bits in the same sequence as the proper tones file given above.



Famous music and sound effects are instances where you can hear reversed duty cycles.  I offer two examples.  The first is the overworld theme from Super Mario Bros.  Composer Koji Kondo intended square waves to be used, so when clone consoles use the 25% rectangle wave instead, the music may sound like its higher pitched (even though it is not).





In the next sample, Level 1-1 of Ninja Gaiden, you cannot really hear anything wrong with the music at first.  (Trust me, you will once you play through more of the game).  In this case, its the sound effects that are frequently wrong.  While the sword slash, jumping, wall climbing and enemy explosion sounds are correct, the ubiquitous item collection sounds, the pause and the timer ticks for the hourglass and fire wheel powers are not right.  The playthroughs will not be 100% in sync with each other, but you should be able to hear the differences.





In these instances, I used the Mesen emulator because it is a very accurate NES emulator and is one of the few that has an option for reversed duty cycles and I do not have a clone with reversed duty cycles.

Clone consoles with Reversed Duty Cycles

Does anyone remember the Generation NEX?  The NEX was a clone console released in 2005 by a company named Messiah Entertainment.  The NEX was the first well-known NES clone released after Nintendo's patents expired after 20 years (from 1985).  It had a 72-pin and a 60-pin slot, an enclosure that evoke the styling of the NES and controller ports that fit true Nintendo controllers.  It had its share of problems, but among its most glaring was the reversed duty cycles.  Many, but not all clones to follow would suffer from this fault. The GamerzTek 8-bit Entertainment System, the RetroN 3 and the Retro-bit Super Retro Trio v2 are more recent clone consoles with reversed duty cycles.  Bizarrely, the Super Retro Trio v1 does not have reversed duty cycles.  Some of the other 2/3-in-1s may or may not have a NOAC with reversed duty cycles, its a crapshoot because sometimes the vendors update their chip.  A chip update does not guarantee that reversed duty cycles will be fixed or prevent reversed duty cycles from appearing where they were not present in earlier hardware.  You are almost always rolling the dice unless you really do your research here.

Where did the reversed duty cycles come from?  Well, back in the 80s and early 90s, Famiclones were typically made in Taiwan.  Frequently they simply cloned the die of the official NES CPU and PPU.  At some point, the Taiwanese semiconductor fab UMC made clone chips of the Nintendo/Ricoh 2A03 CPU and 2C02 PPU.  They were called the UA6527 and UA6528, respectively.  Unfortunately, when UMC were making the CPU, they reversed the duty cycles.  This design prevailed for the most part when these chips were reduced to the single NES-on-a-Clone (NOAC) chips of the late 1990s until the present.   Not all clone consoles using a NOAC suffer from reversed duty cycles.  The ancient Game Axe portable and the Tristar/Super 8 for the SNES do not have reversed duty cycles.

Recently, there have been many NES clones with HDMI and composite video output being sold at very reasonable prices.  These include the GamerzTek 8-bit HD, the Hyperkin Retron HD, Retro-bit RES Plus and Old Skool's Classiq 2 HD.  All of them, except for the first run of the  GamerzTek 8-bit HD, have reversed duty cycles.  (The first run of the GamerzTek 8-bit HD has other audio issues).  If you want an NES HDMI solution without a problem as glaring as reversed duty cycles, you will need to ante up for the Hyperkin RetroN 5 ($150), the RetroUSB AVS ($170) or the Analogue Nt Mini ($449).

It seems that I originally noticed this issue with a clone console over twelve and a half years ago : http://atariage.com/forums/topic/67476-yabos-fc-game-console-usa-version-review/  It has not gone away in that time, it continually rears its ugly head.  As long as there is a market for cheap NES clones, it will remain with us.

13 comments:

  1. "So if a square wave is oscillating at 440Hz, you will hear a "middle C" note."

    440 is actually an A note, not a C.

    ReplyDelete
  2. I received a Generation NEX for Christmas, probably the year it was released, I don't really remember. What I do remember is that the colors were way off, Dragon Warrior II was practically shades of neon. The cartridge slot, or the connector, was fitted weird and inserting and extracting cartridges took some arm strength.

    Years later I found it in my basement and attempted to fire it up out of curiosity...but it wouldn't power on any longer. My original NES, received in 1986, is still working fine to this day.

    ReplyDelete
  3. Maybe my hearing is not as sharp as it once was -- I am well past 40 years old -- but I honestly cannot hear any difference in the sound samples between the normal and reversed duty cycles.

    Is this really considered a major problem?

    ReplyDelete
  4. I think so, I haven't lost my hearing yet :)

    ReplyDelete
  5. Some of us haven't even played on a real NES, here in Slovakia it was never a thing, but many 90s kids like me played on cheap Famiclones that were available for the equivalent of 30 usd at the time. We had a LOT of great fun and we didn't give a damn about something as ridiculous as this. This page condemns something like some beep and boops sounding "wrong" as some horrible flaw. The truth is, most of the people who buy those retro clones don't care about "accurate" NES sound as that is not even what they grew up with or what they are nostalgic for. I am glad that a 32 year old console is even cloned at all. Not everyone is a spoiled kid who got the true original NES back in 1985.

    ReplyDelete
    Replies
    1. Your post is made of nonsense and making generalizations is bad.

      Not everyone who got an NES is/was spoiled. And yes, there are people who actually care about accuracy too.

      It's OK to be nostalgic and want a quality and accurate product to reflect this. When parts and manufacturing techniques are so cheap, no one should settle for an inferior product.

      It's a shame that you never got to experience gaming on a original NES, but don't make generalizations on other people because of it.

      Delete
    2. People getting modern clones of supposed "premium" quality for often premium prices do care to get proper experience and not cheap chips used in cheap famiclones and buggy at that. If product was intended for markets where having duty cycle bug could be a feature and one could switch on or off then even better.

      People who had this bug might want to re-experience their childhood in correct incorrect framerate and with correct incorrect audio. But even then, even in markets like Russia or eastern block countries like Slovakia only minority of people had consoles with this bug and what I find most funny: only rich people (by that time standards) could afford consoles with this kind of bug because only older designs had this bug and back then those were quite expensive products. Cheapest single chip famiclones that later flooded markets didn't have this kind of audio bug so most people do not remember it and do not want it.

      And people might not even care. But only for as long as they do not press jump button in Super Mario Bros ;)

      Delete
  6. How crazy is it that people "don't care" that it's not accurate?! This absolutely drives me nuts and will leave me boycotting a system entirely. I own a LICENSED Sega emulator system and it gets all the sound timings wrong, meaning it never really gets used. Had I known it was a piece of junk in that regard, I never would have bought it.

    ReplyDelete
  7. Two problems. First of all, just because *you* don't care about the sound issues, doesn't mean "most people" don't. These retro systems are clearly targeted at those who grew up with the original consoles, so why not put in the extra work to make it as close as possible to the way people remember it? Secondly, even though this specific article may be discussing some "beeps and boops", that same "who cares?" attitude is one of the reasons why we still have AtGames churning out the same retro Sega systems that have those Gawd Awful sound issues, that gamers have been talking about for years. The music and sound effects are so out of pitch and off-key, that they're unbearable to listen to. If you're going to go through to trouble to emulate old hardware, at least make sure you do it correctly, especially if you're trying to make a profit from it.

    ReplyDelete
  8. I can't believe they could screw up something this simple. IMO it's like driving with your hazard lights on, the clones are essentially misconfigured.

    ReplyDelete
  9. A shame that flawed ASIC design is still being copied to this day.

    I wish a design like the RetroUSB AVS or the Analogue NT were consolidated into an ASIC. That would provide the community for an still good quality product at a more affordable price.

    ReplyDelete
  10. The Dendy famiclones are probably the best famiclones that aren't FPGA. They have proper duty cycles and the Classic models even have expansion audio support from games such as Akumajou Densetsu. If you can find a Dendy Classic for a good price, go for it.

    ReplyDelete
  11. Almost all famiclones I remember were free from duty cycle bug and only those with discrete UMC chips had it but those were found only in more expensive earlier clones. Most people in eg. Poland from where I am, got famiclones with nes-on-chip blob and I do not remember single console of this type with duty cycle bug. Only some people who could afford getting "original" console called "Pegasus" had this bug. Dirty blob-console peasants like us had correct audio... unless they got clone with other bugs and there were quite a lot different revisions and not all were good. At least none of the nes-on-chip designs had jailbars and generally they had less chroma dots giving cleaner picture. I even still have PolyStation™ from 90's and it does have cleaner picture than NES, Famicom or even Twin Famicom which is on its own better than Nintendo products when it comes to quality.

    In either way despite my childhood being full of memories of famiclones I remember correct duty cycle and this bug when I encounter it (eg. this year I got UMC chips to put to one of the Famicoms) I find as jarring as anyone who never used famiclones. There is apparently a way to use original Ricoh CPU from NTSC console with UMC PPU and get proper Dendy timings without duty cycle bug. This is something I will definitely do one day. To me Dendy timings are in some sense more correct... though after playing on Twin Famicom I kinda got used to 60Hz by this point.

    ReplyDelete