You are here: The Oldskool PC/The Guides/Recording The IBM PC Speaker

Recording The IBM PC Speaker

The development of MONOTONE has resurrected an interest in recording the output of the internal speaker in the IBM PC (model 5150) and IBM PC/XT (model 5160). This brief guide will outline options for doing that.

Table of Contents

  1. Background
  2. The best solution: Record with a microphone
  3. Alternate solution: Hook the speaker leads to a line input
  4. Acceptable solution: Use an emulator
  5. Find a clone with line output
  6. Connect the speaker output to your sound card
  7. Acknowledgments

Background

The IBM PC has no traditional sound device to speak of. To generate sound, the speaker is toggled between a 0V and +5V state at regular intervals (to produce a square wave) or irregular intervals (for Pulse Width Modulation). (PWM can be loosely described as toggling the speaker faster than it can physically react, to achieve positions inbetween the 0V and +5V positions.) Most applications for the PC that output sound used square waves for simple tones.

Squarewaves are rich in harmonics, and sound very harsh. They were reliant on the fixed response of the speaker to smooth it out mechanically. Another part of the unique "PC speaker" sound is due to the reverb coming off of the side of the steel case.

The best solution: Record with a microphone

Because that little speaker in the 5150 -- and the 5150 case itself -- is as much a part of the "sound" as the brutally simple circuitry driving it, there is really only one true way to get the best recording of the speaker: Treat it as a live source and use a microphone to record it. How you do that depends on what your goal is: To record the pure sound the speaker is trying to generate, or the complete/authentic 5150 package?

If you want only the audio, it might be better to use a microphone and place the power supply and any hard disks outside the case to reduce background noise. Extending this concept further, put the machine in one room, extend the speaker into a quiet recording space, and mic it.

But what if your goal is recording the authentic 5150 experience? To properly capture that, Gordon JC Pearce offered the following purist solution:

You're going to need a decent mike near the speaker. Of course this is going to catch a certain amount of hard disk noise too, but to get the noise of the floppies right, you're going to want another mike there too. These should be panned left and right, about 40% each way. The fan is a significant noise, so you're going to want a good condenser mike with a popshield somewhat off-axis - this will probably catch the satisfying *clunk* of the Big Orange Switch. Case resonances make up a huge part of the sound - what's the case lid, but a little reverb plate? So, you're going to want a couple of overheads on that panned hard left and right, and maybe a PZM stuck right to the case to bring out some of the warmth.

You're only looking at six channels there, but it should mix down into a nice clean recording of the *real* sound of an IBM 5150.

Alternate solution: Hook the speaker leads to a line input

When Access was promoting RealSound in the late 1980s, their games came with a note on how to get better output from the speaker by hooking it up to the stereo:

Parts required:

  1. Connect one alligator clip to the shielded portion of the cable.
  2. Connect the (-) minus side of the capacitor to the center conductor of the cable and then connect the (+) side of the capacitor to the second alligator clip.
  3. Attach the clip with the capacitor to one of the wires going to your computer's speaker. Attach the other clip to the metal case (ground) somewhere (such as a screw or bolt connection).
  4. Connect the RCA plug to the auxiliary input on your stereo system or boom box. If sound does not come from the stereo, move the alligator clip (with the capacitor) to the other speaker wire.

This works pretty well, but why? The capacitor serves as a way to correct the DC offset inherent in the design. The speaker is connected to a digital (totem-pole) output that switches between 0V and +5V, so the square wave is 5V amplitude peak-to-peak with a 2.5V DC offset. A large DC offset can drive a line input out of range, so you add a capacitor in series to filter out any DC on the signal. One property of a capacitor is that it'll pass AC (the changes in a signal) while 'locking' DC (the steady, average, voltage of the signal). That's the main use here, to remove that 5V standing voltage.

A problem that remains, however, is that most line inputs are 1V peak-to-peak. So the RealSound cable still generates a signal that is too "hot" for most line inputs. (This may have been intentional, since all RealSound audio was 6-bit PCM and not all of it was mastered properly, ie. with dynamic compression.) So the RealSound cable most definitely won't handle square waves properly (we'll ignore the fact that a clipped square wave is still a square wave for the time being; just because the waveform doesn't change shape when clipped doesn't mean it's okay to clip it!). Is there a better cable you can build?

Try a 4.7k resistor onto the hot side of the speaker, 1k resistor from the "free" end of the 4.7k resistor to ground, 1uF cap from the junction of the two resistors to the line in on your desk (and obviously ground to ground on the desk). You may need to fiddle with the EQ to get a nice sound.

Dennis Boone has this overall advice:

If I'm not mistaken, mathematically, it's a high pass filter, with a half-power (3dB down) cutoff frequency of 1/(2*pi*R*C), where R is the impedance of the load (speaker, mixer, whatever) and C is the value of the capacitor in Farads. You would have to work out the impedance, select the desired 3db point, and turn the crank to calculate the needed cap value. You would want to keep in mind that the graph of the filter effect has a shoulder, so that response won't be flat toward the low end of the passband. Their capacitor value would make sense for an 8 ohm speaker and a 4 Hz cutoff. Since the signal is 0-5V, you would need to pad it down, but you'd probably want to try to more or less match the impedance the driver circuit expects. That sort of thing is accomplished with a resistor voltage divider. Line inputs are usually 1 V peak-to-peak.

Finally, Tony Duell came up with the following circuit:

        1uF 
       +
         ||  |           10k 
  o------||  |----------/\/\/----+----- Output 'hot' (centre of RCA plug)
 Hot     ||  |                   |  
 Side of PC                      |
 Speaker                         /
                                 \ 1k
                                 /
                                 \
                                 |
  o------------------------------+------ Output ground
PC ground

...where the hot side of the PC speaker is the terminal not connected to +5V. If you get that wrong, you'll get no sound, but it shouldn't do any damage.

All of the above assumes you have a real speaker to clip leads to, and not a tiny piezo buzzer like some models have on the motherboard. If you have one of those, you'll have to use the solutions listed below.

An alternate circuit by Kiyote was posted on the vintage computer forums:

This is my circuit to go from internal speaker (or piezo dot speaker) to Line Out. The circuit matches the impedance of what the motherboard expects, as well as gives you control so you don't overdrive the input of your amplifier. Parts list.:

  1. a small blank PCB board
  2. a 1k(ohm) to 8(ohm) audio transformer
  3. a SPDT switch audio potentiometer
  4. RCA jack or phone jack
  5. someone who can solder and read schematics

I'll give you the words to do this with less parts as well.

Buy the radio shack audio transformer. On the 8ohm side, connect the leads in place of the audio speaker or piezo speaker (that means desoldering the piezo speaker and putting wires directly on the motherboard). Connect the leads on the 1000 ohm side to your audio jack (headphone wire). Hook up the jack to a headphone audio level control (those little things with knobs for your headphones they sell) to adjust the volume.

There will be either 1 or 2 extra wires on the transformer. They are center tap wires. insulate those and do not use them. Make sure they don't attach anywhere. Check the diagram on the Radio Shack item to see which wires are the outside wires.

Taking the piezo speaker off the motherboard and using this circuit does work. I did it on my own motherboard.

	[pc] -> 8ohm side [transfomer] 1k side -> [audio jack]
	

Because the transformer doesn't worry about which leads are hot or grounded, you don't have to worry about getting which wires right or backwards. The transformer electrically insulates the outside world (amplifier) from the PC, so you don't have to worry about it.

Acceptable solution: Use an emulator

Run your program in DOSBox and hit CTRL-F6 to start/stop .WAV output. DOSBox does a pretty good job of emulating the PC speaker, including modeling how the speaker works (ie. the time it takes to "settle" from one extreme to another), so you can use it to record both square-wave output and PWM output.

Find a clone with line output

If DOSBox isn't working for you for some reason (ie. timing issues not producing the correct output) then there are a number of PC clones that have RCA or line output that you can use to record. For example:

These are just American models that I'm familiar with; I'm sure there are other (UK) model machines (Amstrad?) that have line-out jacks as well.

Hook PC speaker output to your soundcard

If you have a vintage system and a vintage soundcard to go with it, you can always build a cable to connect the speaker output from the motherboard to the soundcard. Alternately, some sound cards will perform this vectoring without needing a cable, such as the Pro Audio Spectrum series of cards.

With either of these solutions, all that remains is for you to record the line-out of your soundcard any way you see fit.

Acknowledgments

I would very much like to thank Tom Peters, Doc Shipley, Dennis Boone, Gordon JC Pearce, Jochen Kunz, and Tony Duell for their responses to the question I posed in the Classic Computers Mailing List (cctalk), whose answers almost entirely composed the preceding article.


[Oldskool Home] [Copyright and Usage] [Disclaimer] [Contact Me]

This page's content was last modified on Dec 21, 2015 4:31 pm.
If anything here has helped you, please consider donating to help keep this site alive.