Sound
-----
  There are two sound channels connected to the output
 terminals SO1 and SO2. There is also a input terminal Vin
 connected to the cartridge. It can be routed to either of
 both output terminals. GameBoy circuitry allows producing
 sound in four different ways:
   Quadrangular wave patterns with sweep and envelope functions.
   Quadrangular wave patterns with envelope functions.
   Voluntary wave patterns from wave RAM.
   White noise with an envelope function.
  These four sounds can be controlled independantly and
 then mixed separately for each of the output terminals.
  Sound registers may be set at all times while producing
 sound.
  When setting the initial value of the envelope and
 restarting the length counter, set the initial flag to 1
 and initialize the data.
  Under the following situations the Sound ON flag is
 reset and the sound output stops:
  1. When the sound output is stopped by the length counter.
  2. When overflow occurs at the addition mode while sweep
     is operating at sound 1.
  When the Sound OFF flag for sound 3 (bit 7 of NR30) is
 set at 0, the cancellation of the OFF mode must be done
 by setting the sound OFF flag to 1. By initializing
 sound 3, it starts it's function.
  When the All Sound OFF flag (bit 7 of NR52) is set to 0,
 the mode registers for sounds 1,2,3, and 4 are reset and
 the sound output stops. (NOTE: The setting of each sounds
 mode register must be done after the All Sound OFF mode
 is cancelled. During the All Sound OFF mode, each sound
 mode register cannot be set.)
  NOTE: DURING THE ALL SOUND OFF MODE, GB POWER CONSUMPTION
 DROPS BY 16% OR MORE! WHILE YOUR PROGRAMS AREN'T USING
 SOUND THEN SET THE ALL SOUND OFF FLAG TO 0. IT DEFAULTS
 TO 1 ON RESET.
  These tend to be the two most important equations in
 converting between Hertz and GB frequency registers:
 (Sounds will have a 2.4% higher frequency on Super GB.)
     gb = 2048 - (131072 / Hz)
     Hz  = 131072 / (2048 - gb)