VRC7 audio

From NESdev Wiki
Revision as of 19:31, 13 April 2012 by Rainwarrior (talk | contribs) (→‎References: fixing link)
Jump to navigationJump to search

The Konami VRC7, in addition to being a mapper chip, also produces 6 channels of 2-operator FM Synthesis Audio. The synthesis core appears to be mostly compatible with the Yamaha YM2413 OPLL.

Registers

Audio Register Select ($9010)

7......0
VVVVVVVV
++++++++- The 8-bit internal register to select for use with $9030

Audio Register Write ($9030)

7......0
VVVVVVVV
++++++++- The 8-bit value to write to the internal register selected with $9010

Internal Audio Registers

The VRCVII appears to have 26 internal registers. Registers $00-$07 define a custom patch that can be played on any channel set to use instrument $0. Registers $10-$15, $20-25, and $30-35 control 6 channels for FM synthesis. Other register values appear to be ignored.

Custom patch

Register Bitfield Description
$00 TVSK MMMM Modulator tremolo (T), vibrato (V), sustain (S), key scaling (K), multiplier (M)
$01 TVSK MMMM Carrier tremolo (T), vibrato (V), sustain (S), key scaling (K), multiplier (M)
$02 KKOO OOOO Modulator key scale level (K), output level (O)
$03 KK-Q WEEE Carrier key scale level (K), unused 0 ? (-), carrier waveform (Q), modulator waveform (W), feedback (E)
$04 AAAA DDDD Modulator attack (A), decay (D)
$05 AAAA DDDD Carrier attack (A), decay (D)
$06 SSSS RRRR Modulator sustain (S), release (R)
$07 SSSS RRRR Carrier sustain (S), release (R)

Channels

Register Bitfield Description
$10-$15 LLLL LLLL Channel low 8 bits of frequency
$20-$25 --ST OOOH Channel sustain (S), trigger (T), octave (O), high bit of frequency (H)
$30-$35 IIII VVVV Channel instrument (I), volume (V)

Each channel x is controlled by three registers at $1x, $2x, and $3x.

The 8 bits of $1x with a 9th bit from bit 0 of $2x create a 9-bit frequency value (freq). This is combined with a 3-bit octave value from $2x (octave) to define the output frequency (F):

     49722 hz * freq
F = -----------------
     2^(19 - octave)

Writing to register $2x either begins a key-on or key-off event, depending on the value in the trigger bit (T). If the trigger bit is 1, a new note begins, if it is 0 it will begin the release portion of its envelope which will eventually silence the channel. If it was already 0, no new key-off will be generated. Note that the octave and high frequency bit cannot be altered between key-on and key-off, but the low 8 bits of frequency in $1x can be used to apply vibrato and pitch bends.

Register $3x selects the instrument patch to use, and chooses a volume. Note that volume value is inverted; $F the lowest volume, and $0 is the highest.

Internal patch set

There are 16 different instrument patches available on the VRC7. With the exception of instrument $0, which can be controlled by registers $00-$07 (see above), these are hardwired into the chip and cannot be altered.

Exact values for the fixed patch set are not yet known, the following table is conjectural:

     00 01 02 03 04 05 06 07
     -----------------------
 0 | -- -- -- -- -- -- -- --
 1 | 31 22 23 07 F0 F0 E8 F7
 2 | 03 31 68 05 F2 74 79 9C
 3 | 01 51 72 04 F1 D3 9D 8B
 4 | 22 61 1B 05 C0 A1 F8 E8
 5 | 22 61 2C 03 D2 A1 A7 E8
 6 | 31 22 FA 01 F1 F1 F4 EE
 7 | 21 61 28 06 F1 F1 CE 9B
 8 | 27 61 60 00 F0 F0 FF FD
 9 | 60 21 2B 06 85 F1 79 9D
 A | 31 A1 FF 0A 53 62 5E AF
 B | 03 A1 70 0F D4 A3 94 BE
 C | 2B 61 E4 07 F6 93 BD AC
 D | 21 63 ED 07 77 F1 C7 E8
 E | 21 61 2A 03 F3 E2 B6 D9
 F | 21 63 37 03 F3 E2 B6 D9

Differences with OPLL

  • Register layout is the same
  • VRC7 has 6 channels, OPLL has 9
  • VRC7 has no rhythm channels, OPLL does (the last 3 channels are either FM or Rhythm on OPLL)
  • VRC7 built-in instruments are NOT the same as OPLL instruments (except for instruments 4,5,7,8 which might be the same on both)
  • VRC7 has no readily-accessible status register, under normal circumstances it is write-only; OPLL has an undocumented, 2-bit 'internal state' register.
  • VRC7 has an internal state output pin (may be serial version of the 2 bit internal state register) and has one output pin for audio, multiplexed for all 6 channels; OPLL has two output pins, one for FM and one for Rhythm, and has no special status pin.

References