SSG
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 noise channel. It is very closely related to the Atari ST's [YM2149].
Programming
Programming the SSG is done through 14 of the YM2610 registers, see YM2610 registers.
Note that the YM2149 I/O registers $E and $F were removed in the YM2610.
Envelope generator
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 | - | CONT | ATT | ALT | HOLD |
- 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 done in 32 steps (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)) = 4000000 / (16 * value)
Example: Note A4 (440Hz) would be 4000000 / (16 * 440) =~ 568 = $238.