Gaming audio has evolved a great deal from the first machines to feature it in the 1970s.
In the beginning: Beeps and clicksOn early machines, there either wasn't any sound hardware, or the sound hardware was extremely simple, being able to click a speaker or play simple tones. This was also the default sound system on IBM PC compatibles for many years, as well as on the Apple.
Programmable sound generatorsOne step up from simple beeps and clicks was the programmable sound generator (PSG), a set of oscillators on a chip that could be programmed in real time. The simplest ones, like the Texas Instruments 76496 and GI/Microchip 8910, had 3 square-wave channels and 1 white noise channel, all with independent volume controls. At the other end of the spectrum was the Commodore 64's SID, a full 3-channel hybrid analog synthesizer with sine, square and triangle wave oscillators, filters and white noise. Many PSGs could be fooled into playing back sampled audio by feeding PCM values into the volume control registers thousands of times a second, as heard on some Game Gear games by "Say-Gah!".
FM synthesizersThe next step up would be FM synthesizers. FM synthesizers work by combining tones of various frequencies together in real time, with up to 4 oscillators working together to make a note. The technique works best for percussion and woodwind instruments, and tends to sound "plasticky" or "metallic" if asked to recreate a whole orchestra. It's excellent for making strange noises and sound effects. When FM synthesis was popular, Yamaha owned the patents, so pretty much all arcade and console games that used FM used a Yamaha FM synthesizer chip to do the work. The Sega Genesis had a Yamaha FM+PSG chip inside, and the OPL series chips became famous from their use on PC sound cards.
Sample playback/PCM synthesisThe crown of gaming audio, Pulse-Code Modulation systems work from actual samples of instruments, making their sound much richer. Since they can reproduce practically any sound, all sorts of odd effects are possible. PCM engines typically don't do any mathematical synthesis on their own, preferring instead to mix samples together at various speeds and volumes; however, high-end samplers used in music composition can filter the sound and do all sorts of other tricks. DSPs may be present to add effects like echo and reverb. The first popular gaming platforms to use a PCM sound system were the Amiga and SNES; the NES and Sega Genesis both had rudimentary PCM support, but this was mainly used for pre-recorded voices, sound effects, and drums. Pretty much every system introduced since uses PCM. On PCs, PCM started to take over from FM in the early 1990s, when the first sound cards with samplers on-board appeared; as CPU power increased, especially after the Pentium and PowerPC processors became popular (around 1995), PC games began using software PCM engines to play instruments and sound effects.
Pre-recorded audioFinally, once games started to ship on CD media, prerecorded audio became common, especially on PCs where the audio could be played from the CD just like any other song, while the game data lived in memory. Many games use MP3 or Ogg files to accomplish the same thing now. See also Video Games, Pac Man Fever.