My PC speaker PWM story

Here is another story from the same era (early 1990′s). It is a continuation to my LPT DAC story. Before PC sound cards became popular, around same time as LPT DAC circuits became popular, PC speaker was also used to play back digital audio. Software (game and other) wanted to have the option to use PC speaker in case the user did not have LPT DAC or sound card. PC speaker was originally designed for just simple “beep” sounds, but with suitable programming PC speaker can be used to play back digital sampled sounds: The trick was to use send pulse-width modulated  (PWM) signal to PC speaker. The average value of voltage fed to the load is controlled by turning the switch between supply and load on and off at a fast pace. This was the same principle as used inso called “Class-D amplifiers“.

The programming trick in the PC was to set the timer that drive PC speaker to one-shot mode, and set PC interrupt rate to needed output sample rate. So at every input one sound sample value was read, converted to timer control value, programmed to timer (starting the pulse). This trick allowed around 6 bits sample resolution / dynamics (or even slightly more with some tricks). When the sample rate was high enough, you can’t hear the high frequency noise on the signal.

I even made a very good playback routines to play sampled audio through PC speaker with PWM. One day in late 1990 Epic Megagames contacted me to add my PC speaker routines to their upcoming Drum Blaster software (check video to get idea of software). Things went well up to the point when it turned out that someone had patented PWM sample playback on PC speaker (thing that they should not have granted patent in the first place because the technology was used years before the patent application was submitted by many other people). This was the first time I was hit with the flawed US software patent system


  1. Tomi Engdahl says:

    How Did They Get Sampled Sounds From An SN76849 8-bit Sound Chip?
    So, how can a set of audio tone generators be turned into a sampled audio player, and how can it be done when the CPU is a relatively puny 6502?

    Sampled sound 1980s style: from SN76489 square waves to samples

  2. Tomi Engdahl says:

    Every year in the month of June, someone by the unlikely name of posts a question to the Linux Kernel Mailing List asking whether a Linux kernel module is possible that would blow the PC speaker. It’s fairly obviously a joke, which is why the UK-based anti-virus company Sophos have devoted a light-hearted blog post to it. The post is an interesting diversion into early PC sounds, when the only hardware guaranteed to be present was a small speaker hooked up to a bit on an output port….

  3. Galas Thierry says:

    For the history: I created a crude blocking procedure to play PCM sound using pulse width modulation on PC at the end of 1988, no interruption, manual adjustment of sampling frequency. I was preparing Phd in LAFORIA a Paris 6 university lab. The piece of software was distributed to master students to allow then to try speech synthesis. Some months later , a russian student, part time hacker demonstrates me a russian game playing some russian music … maybe the start of story …


Leave a Comment

Your email address will not be published. Required fields are marked *