PC speaker
From Wikipedia, the free encyclopedia
| This article may contain original research or unverified claims. Please improve the article by adding references. See the talk page for details. (May 2009) |
A PC speaker is a monophonic 2.25 inch magnetic driven midrange speaker, later replaced by a piezoelectric tweeter[1] , built into some IBM PC compatible desktop computers. The first IBM Personal Computer, model 5150, employed a standard 2.25 inch magnetic driven speaker as a tone generator.[2] This allowed software and firmware to provide auditory feedback to a user, such as to report a hardware fault.
A PC speaker generates waveforms using the Programmable Interval Timer.[citation needed] The PC speaker was often used in very innovative ways to create the impression of polyphonic music or sound effects within computer games of its era, such as the LucasArts series of adventure games from the mid-1990s, using swift arpeggios.[citation needed] Several programs, including MP (Module Player, 1989), ScreamTracker, Fast Tracker, Impulse Tracker, and even device drivers for Linux[3] and Microsoft Windows, could play pulse-code modulation (PCM) sound through the PC speaker using special techniques explained later in this article. Several games such as Space Hulk and Pinball Fantasies were noted for their elaborate sound effects; Space Hulk in particular even had full speech. However, because the method used to reproduce PCM was very sensitive to timing issues, these effects either caused noticeable sluggishness on slower PCs, or sometimes failed completely on faster PCs (that is, significantly faster than the program was originally developed for).
Contents |
[edit] Pinouts
In some applications, the PC speaker is affixed directly to the computer's motherboard; in others,including the first IBM Personal Computer, the speaker is attached to a lead, which attaches to a DC connector on the motherboard. A wired PC speaker connector may have a two-, three-, or four-pin configuration, and either two or three wires. The female connector of the speaker connects to pin headers on the motherboard, which are sometimes labeled SPEAKER or SPKR.
| Pin Number | Pin Name | Pin Function |
|---|---|---|
| 1 | -SP | Negative voltage |
| 2 | [KEY] | None (unwired) |
| 3 | GND | Ground |
| 4 | +SP5V | 5 VDC (volts of direct current), positive voltage |
[edit] Pulse-width modulation
| This article may be confusing or unclear to readers. Please help clarify the article; suggestions may be found on the talk page. (May 2009) |
The PC speaker is normally meant to reproduce a square wave via only 2 levels of output, driven by channel 2 of the Intel 8253 (PC, XT) or 8254 (AT and later) Programmable Interval Timer operating in mode three (square wave signal). The speaker hardware itself is directly accessible via PC I/O port 61H (61 hexadecimal) via bit 1 and can be physically manipulated for 2 levels of output (i.e. 1-bit sound). However, by carefully timing a short pulse (i.e. going from one output level to the other and then back to the first), it is possible to drive the speaker to various output levels in between the two defined levels. This effectively allows the speaker to function as a crude DAC, thereby enabling approximate playback of PCM audio. This technique is called pulse-width modulation (PWM) and is notably used in class D audio amplifiers.
Getting a high fidelity sound output out of this technique requires the switching frequency between the minimum and maximum sound levels to be much higher than the audio frequencies meant to be reproduced (typically with a ratio of 10:1 or more), and the output voltage to be bipolar in order to make better use the output devices' dynamic range and power (e.g. by making a loudspeaker vibrate in both directions). On the PC speaker, however, the output voltage is either zero or TTL level (unipolar). As a result, the precision of this technique when used on the PC speaker is comparable at best to a 6-bit PCM DAC, while the final audio results will depend on precise timing and the nature of the reproduced sound.
The audio fidelity of this technique will be further decreased by the lack of a properly sized dynamic loudspeaker, typical of modern machines and particularly laptops, that use a piezoelectric speaker. The reason for this is that PWM-produced audio requires a low-pass filter before the final output in order to suppress switching noise and high harmonics, something that a normal dynamic loudspeaker can do on its own right, while a piezoelectric speaker will let most switching noise pass, as will many direct couplings (though there are exceptions to this, e.g. filtered "speaker in" ports on some motherboards and sound cards).
[edit] See also
[edit] Notes
| This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. Please improve this article by introducing more precise citations where appropriate. (September 2007) |
- ^ Rosenthal, Morris (August 2008). Computer Repair with Diagnostic Flowcharts (Revised ed.). Foner Books. pp. 9. ISBN 978-0972380171. http://www.fonerbooks.com/pcrepair.htm.
- ^ http://computermuseum.usask.ca/articles/IBM-5150-Specifications.pdf
- ^ Sergeev, Stas. "PC-Speaker PCM driver for Linux". http://www.geocities.com/stssppnn/pcsp.html. Retrieved on 2009-02-15.
[edit] External links
- Site for old PC without sound cards.
- GameDev.net article on programming the PC Speaker.
- Part 1 of another article about programming the PC speaker.
- Part 2 of the article
(includes a very detailed explanation of how to play back PCM audio on the PC speaker, and why it works) - Bleeper Music Maker A freeware to use the PC speaker to make music
- Article about programming PC speaker using C++
- Commandline PC speaker program for LinuxFTP

