Skip to main content
The console from Nintendo that plays Super Mario Bros. and helped revive the agonizing video game market in the US during mid-80s. Also known as Family Computer (Famicom), especially in Japan. The console is powered by the Ricoh 2A03, a CPU with sound generator built-in. It has five channels:
  • First two channels: Pulse wave with three different duty cycles
  • Third channel: Fixed-volume triangle channel
  • Fourth channel: Noise channel (can work in both pseudo-random and periodic modes)
  • Fifth channel: (D)PCM sample channel

Effects

EffectDescription
11xxWrite to delta modulation counter
Range: 00-7F
This may be used to attenuate the triangle and noise channels (see “non-linear mixing” below)
Will not work if a sample is playing
12xxSet duty cycle or noise mode
Pulse channels (0-3):
0: 12.5%
1: 25%
2: 50%
3: 75%
Noise channel (0-1):
0: Long (15-bit LFSR, 32767-step)
1: Short (9-bit LFSR, 93-step)
13xySetup sweep up
x: Time
y: Shift
Set to 0 to disable
14xySetup sweep down
x: Time
y: Shift
Set to 0 to disable
15xxSet envelope mode (pulse and noise channels only)
0: Envelope + length counter (volume = envelope duration)
1: Length counter (volume = output volume)
2: Looping envelope (volume = envelope duration)
3: Constant volume (default, volume = output volume)
You may need to apply a phase reset to make the envelope effective
16xxSet length counter
See table below for possible values
This will trigger phase reset
17xxSet frame counter mode
0: 4-step (NTSC: 120Hz sweeps/lengths, 240Hz envelope)
1: 5-step (NTSC: 96Hz sweeps/lengths, 192Hz envelope)
18xxSet PCM channel mode
00: PCM (software)
01: DPCM (hardware)
In DPCM mode, samples will sound muffled and available pitches are limited
19xxSet triangle linear counter
00-7F: Set the counter
80+: Halt it
20xxSet DPCM frequency (DPCM mode only)
See table below for possible values
Short noise may sound very different depending on its initial LFSR state. More info can be found at NESdev.

Non-Linear Mixing

The triangle, noise, and PCM channels are mixed together non-linearly such that the level of the DMC (the “delta modulation counter”, representing the PCM channel’s amplitude) inversely affects the volume of the others. This can be intentionally used with effect 11xx to hold the DMC at a level that lowers the volume of the triangle channel in a controlled fashion; at maximum DMC level (117F) the triangle plays at about 57% of full volume.

DPCM Samples

Due to hardware limitations:
  • A loop in a DPCM sample must start on a multiple of 512 samples (512, 1024, 1536…)
  • Loop length must be a multiple of 128 plus 8 samples (136, 264, 392…)
NES DPCM only has 16 preset sample rates (see DPCM frequency table below).

Envelope Mode

Both pulse channels and the noise channel have a simple hardware envelope generator with two modes:
  • One that holds the volume at whatever the software sets
  • One that creates a downward ramp of volume starting from maximum and counting down to 0
The volume range of the ramp can’t be controlled (similar to the triangle wave). The envelope can be set to loop each time it reaches 0.

Frame Counter

The frame counter is a global counter that controls the speed of hardware envelopes and sweeps. The resulting speed depends on both the chip’s clock rate and whether it’s set to 4-step or 5-step mode.

Length Counter

Setting the length counter will automatically stop a note after the specified amount of time. See the length counter table below for effect values and their corresponding durations.

Chip Configuration

The following options are available in the Chip Manager window:
  • Clock rate: Sets the rate at which the chip will run
  • DPCM channel mode: Allows you to set which mode to use for the DPCM channel
    • DPCM: The default mode, playing 1-bit DPCM samples as supported by the hardware
    • PCM: This mode provides crisper 7-bit samples by writing to the delta counter directly. Uses a lot of CPU time in console

Instrument Editor

This chip uses the NES instrument editor.

Reference Tables

For detailed frequency tables, length counter values, and short noise frequencies, please refer to:

Build docs developers (and LLMs) love