SSG: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
(Created page with "The SSG ('''S'''oftware-controlled '''S'''ound '''G'''enerator as Yamaha calls it) is part of the {{Chipname|YM2610}} sound chip. It provides 3 square wave channels and 1 nois...")
 
m (Moved registers, note about mixing)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
The SSG ('''S'''oftware-controlled '''S'''ound '''G'''enerator as Yamaha calls it) is part of the {{Chipname|YM2610}} sound chip. It provides 3 square wave channels and 1 noise channel. It is very closely related to the Atari ST's [[http://www.ym2149.com/ym2149.pdf YM2149]].
The SSG ('''S'''oftware-controlled '''S'''ound '''G'''enerator as Yamaha calls it) is part of the {{Chipname|YM2610}} sound chip. It provides '''3 square wave channels''' and '''1 LFSR noise channel'''. It is very closely related to the Atari ST's [[http://www.ym2149.com/ym2149.pdf YM2149]].


=Programming=
Given its limited capacities, the SSG is more often used for simple sound effects (coin sound, cursors in menus...) rather than music.
 
Programming the SSG is done through 14 of the YM2610 registers, see [[YM2610_registers#SSG_part|YM2610 registers]].
 
Note that the YM2149 I/O registers $E and $F were removed in the YM2610.


=Envelope generator=
=Envelope generator=
Line 22: Line 18:
Envelope frequency = 8M / 2 / (256 * value)
Envelope frequency = 8M / 2 / (256 * value)


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


=Synthesis=
=Synthesis=
Line 28: Line 24:
If the '''Mode''' bit in the volume registers is 1, the EG's output is used instead of the fixed 4 bit value.
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 = [[clock|8M]] / 2 / (16 * (Coarse * 256 + Fine)) = 4000000 / (16 * value)
Tone frequency = [[clock|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.


Example: Note A4 (440Hz) would be 4000000 / (16 * 440) =~ 568 = $238.
{| class="regdef"
|'''Address ([[Z80]] port 4)'''
|'''Data ([[Z80]] port 5)'''
|
|-
|$00
|{{8BitRegister|Fine tune|8}}
|rowspan="2"|Channel A
|-
|$01
|{{8BitRegister|-|4|Coarse tune|4}}
|-
|$02
|{{8BitRegister|Fine tune|8}}
|rowspan="2"|Channel B
|-
|$03
|{{8BitRegister|-|4|Coarse tune|4}}
|-
|$04
|{{8BitRegister|Fine tune|8}}
|rowspan="2"|Channel C
|-
|$05
|{{8BitRegister|-|4|Coarse tune|4}}
|-
|$06
|{{8BitRegister|-|3|Noise tune|5}}
|Noise channel
|-
|$07
|{{8BitRegister|-|2|/EN noise C|1|/EN noise B|1|/EN noise A|1|/EN tone C|1|/EN tone B|1|/EN tone A|1}}
|Negative enable flags for mixing
|-
|$08
|{{8BitRegister|-|3|Mode|1|Volume|4}}
|Channel A
|-
|$09
|{{8BitRegister|-|3|Mode|1|Volume|4}}
|Channel B
|-
|$0A
|{{8BitRegister|-|3|Mode|1|Volume|4}}
|Channel C
|-
|$0B
|{{8BitRegister|Volume envelope period fine tune|8}}
|
|-
|$0C
|{{8BitRegister|Volume envelope period coarse tune|8}}
|
|-
|$0D
|{{8BitRegister|-|4|Volume envelope shape|4}}
|See diagram.
|}


[[Category:Audio system]]
[[Category:Audio system]]

Latest revision as of 18:47, 11 February 2017

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.