SSG

From NeoGeo Development Wiki
Jump to navigation Jump to search

The SSG (Software-controlled Sound Generator as Yamaha calls it) is part of the YM2610 sound chip. It provides 3 square wave channels and 1 LFSR noise channel. It is very closely related to the Atari ST's [YM2149].

Given its limited capacities, the SSG is more often used for simple sound effects (coin sound, cursors in menus...) rather than music.

Envelope generator

File:Ym2610egshapes.png
Selectable EG shapes of the SSG

The Envelope generator (EG) is an unique low-frequency signal generator which can be used to modulate the output of the tone channels.

Envelope shape register ($0D):

Bit 7 6 5 4 3 2 1 0
Def - CONTATTALTHOLD
  • CONT: Should always be 1 ?
  • ATT: Counter direction (0:Down, 1:Up)
  • ALT: Alternate direction each period
  • HOLD: Hold value after first period (depends on ALT)

Envelope frequency = 8M / 2 / (256 * value)

Note that each period is 32 analog steps (5-bit internal counter).

Synthesis

If the Mode bit in the volume registers is 1, the EG's output is used instead of the fixed 4 bit value.

Tone frequency = 8M / 2 / (16 * (Coarse * 256 + Fine)) = 250000 / value

Example: Note A4 (440Hz) would be 250000 / 440 =~ 568 = $238.

Each channel is an AND (?) sum of both the channel's tone generator (if enabled) and the unique noise generator (if enabled).

Registers

Note that the YM2149 I/O registers $E and $F were removed in the YM2610.

Address (Z80 port 4) Data (Z80 port 5)
$00
Bit 7 6 5 4 3 2 1 0
Def Fine tune
Channel A
$01
Bit 7 6 5 4 3 2 1 0
Def - Coarse tune
$02
Bit 7 6 5 4 3 2 1 0
Def Fine tune
Channel B
$03
Bit 7 6 5 4 3 2 1 0
Def - Coarse tune
$04
Bit 7 6 5 4 3 2 1 0
Def Fine tune
Channel C
$05
Bit 7 6 5 4 3 2 1 0
Def - Coarse tune
$06
Bit 7 6 5 4 3 2 1 0
Def - Noise tune
Noise channel
$07
Bit 7 6 5 4 3 2 1 0
Def - /EN noise C/EN noise B/EN noise A/EN tone C/EN tone B/EN tone A
Negative enable flags for mixing
$08
Bit 7 6 5 4 3 2 1 0
Def - ModeVolume
Channel A
$09
Bit 7 6 5 4 3 2 1 0
Def - ModeVolume
Channel B
$0A
Bit 7 6 5 4 3 2 1 0
Def - ModeVolume
Channel C
$0B
Bit 7 6 5 4 3 2 1 0
Def Volume envelope period fine tune
$0C
Bit 7 6 5 4 3 2 1 0
Def Volume envelope period coarse tune
$0D
Bit 7 6 5 4 3 2 1 0
Def - Volume envelope shape
See diagram.