Recent from talks
Nothing was collected or created yet.
PC speaker
View on Wikipedia
Dynamic speaker with 4-pin connector | |
| Date invented | 1981 |
|---|---|
| Invented by | IBM |
| Connects to | Motherboard |
| Use |
|
| Common manufacturers |
|
A PC speaker is a loudspeaker built into some IBM PC compatible computers. The first IBM Personal Computer, model 5150, employed a standard 2.25 inch magnetic driven (dynamic) speaker.[1] More recent computers use a tiny moving-iron or piezo speaker instead.[2] The speaker allows 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, an Intel 8253 or 8254 chip.[3]
Use cases
[edit]BIOS/UEFI error codes
[edit]The PC speaker is used during the power-on self-test (POST) sequence to indicate errors during the boot process. Since it is active before the graphics card, it can be used to communicate "beep codes" related to problems that prevent the much more complex initialization of the graphics card to take place. For example, the Video BIOS usually cannot activate a graphics card unless working RAM is present in the system while beeping the speaker is possible with just ROM and the CPU registers. Usually, different error codes will be signalled by specific beeping patterns, such as e.g. "one beep; pause; three beeps; pause; repeat". These patterns are specific to the BIOS/UEFI manufacturer and are usually documented in the technical manual of the motherboard.
Software
[edit]Several programs, including music software, operating systems or games, could play pulse-code modulation (PCM) sound through the PC speaker using special Pulse-width Modulation techniques explained later in this article.
Games
[edit]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-1980s, using swift arpeggios.[citation needed] 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 on faster PCs (that is, significantly faster than the program was originally developed for). Also, it was difficult for programs to do much else, even update the display, during the playing of such sounds. Thus, when sound cards (which can output complex sounds independent from the CPU once initiated) became mainstream in the PC market after 1990, they quickly replaced the PC speaker as the preferred output device for sound effects. Most newly-released PC games stopped supporting the speaker during the second half of the 1990s.
Other programs
[edit]Several programs, including MP (Module Player, 1989), Scream Tracker, Fast Tracker, Impulse Tracker, and even device drivers for Linux[4] and Microsoft Windows, could play PCM sound through the PC speaker, though with marginal sound quality.
Modern Microsoft Windows systems have PC speaker support as a separate device with special capabilities – that is, it cannot be configured as a normal audio output device. Some software uses this special sound channel to produce sounds. For example, Skype can use it as a reserve calling signal device for the case where the primary audio output device cannot be heard (for example because the volume is set to the minimum level, the amplifier is turned off or headphones are plugged in).[citation needed]
Linux kernel includes the "snd-pcsp.ko" driver module since 2008.[5] Once the module is loaded, the PC speaker can be used as a normal sound card, allowing all programs (applications, graphical desktops, utilities, etc.) to play sounds and music through the PC speaker. By default, Linux kernel loads the "pcspkr.ko" module, that only emits beeps. To get full sounds and music through the PC speaker (and also beeps), you have to unload "pcspkr.ko" and load "snd-pcsp.ko": modprobe -r pcspkr && modprobe snd-pcsp
In the 1990s, a computer virus for Microsoft DOS named "Techno" appeared, playing a melody through the PC speaker while printing the word "TECHNO" on the screen until filled.[6]
Pinouts
[edit]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 by wire to a connector on the motherboard. Some PC cases come with a PC speaker preinstalled. 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 typically labeled SPEAKER, SPKR or SPK.
| Pin Number | Pin Name | Pin Function |
|---|---|---|
| 1 | -SP | Speaker negative |
| 2 | GND or KEY | Ground, or unwired key |
| 3 | GND | Ground |
| 4 | +SP5V | Speaker positive +5V DC |
Pulse-width modulation
[edit]The PC speaker is normally meant to reproduce a square wave via only 2 levels of output (two voltage levels, typically 0 V and 5 V), 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), and by relying on the speaker's physical filtering properties (limited frequency response, self-inductance, etc.), it is possible to drive the speaker to various intermediate output levels, functioning as a crude digital-to-analog converter. This technique is called pulse-width modulation (PWM) and allows approximate playback of PCM audio. (A more refined version of this technique is used in class D audio amplifiers.)
With the PC speaker this method achieves limited quality playback. Nevertheless, a commercial solution named RealSound used it to provide impressive-for-its-time sound on several games.
Obtaining a high fidelity sound output using this technique requires a switching frequency 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 of the output devices' dynamic range and power. On the PC speaker, however, the output voltage is either zero or at a Transistor-Transistor Logic (TTL) level (unipolar).
The quality depends on a trade-off between the PWM carrier frequency (effective sample rate) and the number of output levels (effective bit depth). The clock rate of the PC's programmable interval timer which drives the speaker is fixed at 1,193,180 Hz,[3] and the product of the audio sample rate times the maximum DAC value must equal this. Typically, a 6-bit DAC[9] with a maximum value of 63 is used at a sample rate of 18,939.4 Hz, producing poor but recognizable audio.[10]
The audio fidelity of this technique is further decreased by the lack of a properly sized dynamic loudspeaker, specially in modern machines and particularly laptops that use a tiny moving-iron speaker (often confused with piezoelectric). 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. A normal dynamic loudspeaker does this naturally, but the tiny metal diaphragm of the moving-iron speaker will let much 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).
This use of the PC speaker for complex audio output became less common with the introduction of Sound Blaster and other sound cards.
See also
[edit]Notes
[edit]- ^ IBM 5150 Technical Reference (PDF). IBM. 1984. pp. 1–25.
- ^ Rosenthal, Morris (August 2008). Computer Repair with Diagnostic Flowcharts (Revised ed.). Foner Books. p. 9. ISBN 978-0-9723801-7-1.
- ^ a b "Bran's Kernel Development Tutorial: The Programmable Interval Timer". www.osdever.net. Retrieved 23 January 2023.
- ^ Sergeev, Stas. "PC-Speaker PCM driver for Linux". Archived from the original on 26 October 2009. Retrieved 15 February 2009.
- ^ "PC-Speaker support". Kernelconfig. Retrieved 17 July 2025.
- ^ Nastasi, Alison (19 July 2014). "The World's Worst Computer Viruses Illustrated". Flavorwire. Retrieved 11 September 2021.
- ^ Ögren, Joakim (1997). The Hardware Book (PDF). p. 290.
- ^ ASUS P5KPL-AM SE Motherboard manual (PDF). ASUSTek Computer Inc. 2008. pp. 1–13. Archived from the original (PDF) on 13 October 2017. Retrieved 27 February 2017.
- ^ Leonard, Jim (2022). "IBM PC Sound Ramblings - The Best Sound You've Never Heard". The Oldskool PC. Retrieved 31 August 2022.
- ^ Schlunder, Edward (18 November 2006). "Resistor/Pulse Width Modulation DAC". K9spud Microcontroller Electronics. Archived from the original on 17 March 2017.
External links
[edit]- Smacky Open-source C++ software for playing (monophonic) music on the PC speaker.
- Site for old PC without sound cards.
- Programming the PC Speaker, by Mark Feldman for PC-GPE.
- Programming the PC Speaker, by Phil Inch: part 1, part 2 (includes a very detailed explanation of how to play back PCM audio on the PC speaker, and why it works)
- Bleeper Music Maker Archived 10 February 2023 at the Wayback Machine A freeware to use the PC speaker to make music (superseded by BaWaMI Archived 30 January 2022 at the Wayback Machine)
- Beep for Linux and Windows, by Frank Buß. APIs for beeping.
- Commandline PC speaker program for Linux Archived 16 December 2008 at the Wayback MachineFTP
- Practical article on implementing a Linux Kernel Driver
- Timing on the PC family under DOS (Sections 7.5, 7.29, 7.30, and 10.7 – 10.7.4 in particular)
PC speaker
View on GrokipediaHistory and Development
Origins in early computing
The origins of audio output in early computing trace back to the bell mechanisms incorporated into teletypewriters and terminals for providing operator alerts. These devices, dating to the late 19th century in telegraphy, evolved into standard features of minicomputer systems by the 1970s, where the ASCII bell character (BEL, control code 7) was used to trigger an audible signal for attention or error notification. In Digital Equipment Corporation's PDP-11 minicomputers, introduced in 1970, terminals like the VT52 implemented this through a buzzer activated by the BEL character, providing monaural feedback during interactive sessions.[5] By the mid-1970s, basic beepers had become integral to minicomputers and emerging microcomputer terminals, employing simple electromagnetic or piezoelectric transducers to generate short tones without complex audio circuitry. Piezoelectric buzzers, developed by Japanese manufacturers in the early 1970s, offered compact, low-power alternatives for these alerts, producing vibrations through the piezoelectric effect when driven by electrical signals. In PDP-11 setups, such transducers in terminals provided reliable monaural output for system status or user prompts, marking a shift from mechanical teletype bells to electronic signaling in computing environments.[6] A pivotal technical advancement was the adoption of timer integrated circuits, exemplified by the 555 timer IC released by Signetics in 1971, which enabled the generation of square wave signals for precise tonal control. Configured in astable mode with resistors and capacitors, the 555 produced audible frequencies typically between 100 and 5000 Hz, suitable for beeps in resource-constrained systems. This facilitated programmable alerts in early hardware designs. Hobbyist microcomputer kits popularized these beepers for practical feedback, with the IMSAI 8080 system in 1975 incorporating an audible tone speaker in its PCS-80 keyboard terminal to confirm boot operations and key entries via simple beeps.[7] Such implementations laid the groundwork for the basic speaker integration seen in later personal computers like the IBM PC.Introduction and evolution in personal computers
The PC speaker debuted with the IBM Personal Computer Model 5150 in 1981 as a basic audio output device integrated into the system unit. It consisted of a 2.25-inch permanent magnet magnetic transducer mounted on the motherboard and connected via a 4-pin Berg connector, with control lines tied to the expansion bus for system-level signaling.[8][1] This simple hardware allowed for rudimentary sound generation, primarily beeps for user feedback and diagnostics, without dedicated audio processing. The speaker's operation relied on integration with the Intel 8255A Programmable Peripheral Interface (PPI) chip for enabling and gating signals via I/O port 61h, and the Intel 8253 Programmable Interval Timer (PIT) chip's Channel 2 for frequency control using a 1.193 MHz clock input. Basic tone generation occurred through square-wave output from the PIT in Mode 3, producing frequencies ranging from approximately 18 Hz to nearly 600 kHz depending on the 16-bit counter value loaded into the timer, though practical audible range is limited by the speaker's response.[3] The design persisted through subsequent IBM models, including the PC XT (Model 5160) released in 1983 and the PC AT (Model 5170) in 1984, retaining the 2.25-inch magnetic transducer and similar control circuitry for compatibility.[9] In the IBM PS/2 line introduced in 1987, such as the Model 25, the speaker evolved into an integrated beeper with the same PIT-based control via port 61h, though minor circuit adjustments like resistor values affected output impedance and volume compared to earlier XT/AT systems.[10] Many PC clones in the mid-1980s retained the dynamic speaker, but by the late 1980s and 1990s, cost-saving measures led to widespread adoption of smaller piezoelectric beepers. PC clones from manufacturers like Compaq and Dell maintained this feature throughout the 1990s to ensure BIOS compatibility and system beeps, often using equivalent magnetic transducers on their motherboards.[2][11] The PC speaker's prominence began to decline in the late 1980s with the rise of dedicated sound cards, starting with the AdLib in 1987, which introduced FM synthesis for richer game audio, followed by the Sound Blaster in 1989, which added digitized sound capabilities and became the industry standard.[12] Despite this shift toward external audio solutions for entertainment, the speaker remained a standard feature on ATX motherboards into the 2020s, typically via a 4-pin header for POST beeps, though the included physical speaker became less common after the early 2000s, with many users needing to purchase one separately. In the 1990s, laptops commonly used compact piezoelectric variants while preserving basic tone functionality.Hardware Design
Physical and electrical components
The PC speaker features a compact electromagnetic driver, typically measuring 2.25 inches in diameter, consisting of a paper cone attached to a voice coil suspended in the field of a permanent magnet.[1] This design allows the cone to vibrate in response to electrical signals, producing audible sound through mechanical motion. In compact variants, such as those in portable systems, a piezoelectric disc replaces the electromagnetic driver, converting electrical energy directly into vibrations via the piezoelectric effect for simpler integration.[13] Electrically, the speaker operates on 5V DC logic levels supplied directly from the motherboard, with no dedicated amplification stage; instead, it relies on digital drive signals toggled via I/O ports to generate output.[1] The original IBM PC speaker was rated at approximately 0.5 W.[1][2] Impedance varies by type, with electromagnetic drivers commonly at 8 ohms and piezoelectric variants up to 100 ohms, enabling direct connection to logic-level outputs.[13][2] The frequency response is inherently limited to roughly 100 Hz to 2 kHz due to the single-driver simplicity and small size, focusing on mid-range tones rather than full-spectrum reproduction.[14] Integration involves mounting the speaker on the motherboard or within the chassis, wired to a 4-pin Berg connector for power and signal delivery, as seen in the original IBM PC design.[1] This connector includes a +5V supply pin, ground, and data lines, ensuring straightforward interfacing without additional circuitry.[1]Connections and pinouts
The PC speaker in the IBM PC and PC/AT systems connects to the motherboard via a 4-pin Berg connector with a 2.54 mm pitch, providing power, ground, and signal lines for integration with the system's audio output circuitry.[1] This connector type, often equivalent to Molex KK series in compatible hardware, ensures reliable mechanical and electrical mating for internal installation.[1] The standard pinout for the IBM PC/AT 4-pin header is as follows:| Pin | Function | Description |
|---|---|---|
| 1 | Data | Speaker signal input from the AND gate combining PIT channel 2 output and port 61h bit 0 (TTL logic: high for on, low for off). |
| 2 | Key | No connection (polarization key to prevent reverse insertion). |
| 3 | Ground | Reference ground to establish signal integrity and minimize electromagnetic noise. |
| 4 | +5V | Power supply for the speaker coil (nominal 5 V DC). |
Sound Generation
Basic principles of operation
The PC speaker operates by generating simple tones through digital control from the CPU, primarily using the square wave output of channel 2 from the Intel 8253 Programmable Interval Timer (PIT). The CPU programs the PIT by writing a control word to I/O port 0x43 to select channel 2, access mode (low byte then high byte), and mode 3 (square wave generator), followed by loading a 16-bit divisor into port 0x42. This divisor determines the output frequency of the PIT, which toggles a digital signal at the desired rate. The PIT's input clock runs at approximately 1.193182 MHz, derived from dividing the system's 14.31818 MHz oscillator by 12.[1][17] The tone frequency is calculated as , where is the divisor value loaded into the PIT counter (ranging from 1 to 65,535; a value of 0 is interpreted as 65,536). For example, to produce a tone near 1000 Hz, the divisor is set to 1193, yielding Hz. The PIT output signal is then routed through I/O port 0x61, where bit 1 enables the connection from the PIT to the speaker driver circuit, and bit 0 turns the speaker on or off. This digital square wave signal drives a simple transistor-based amplifier on the motherboard, typically an NPN transistor with the PIT output connected to its base.[1][18][17] Sound production occurs as the square wave toggles the transistor, creating an alternating current through the speaker's electromagnetic coil. When the transistor is on (PIT output high), current flows from +5V through the coil to ground, generating a magnetic field that moves the speaker cone outward against a spring. When off (PIT output low), the current stops, the magnetic field collapses, and the spring pulls the cone back. This rapid vibration of the cone at the signal frequency produces audible beeps in the human hearing range (typically 20 Hz to 20 kHz, though practical tones are 100–5000 Hz). The volume is fixed at a low level (around 0.5 W), with no amplitude control, as the drive is binary on/off without modulation.[1] The PC speaker supports only monophonic output, limited to a single tone at a time due to the single-channel PIT connection. The square wave nature introduces odd harmonics, resulting in a harsh, buzzy timbre that is characteristic but unsuitable for complex audio reproduction, as it lacks the smooth waveform of analog sources. The signal from the PIT channel 2 output pin is briefly routed via the motherboard's pinout to the driver transistor before reaching the 4-pin speaker connector.[1][17]Advanced techniques like pulse-width modulation
Pulse-width modulation (PWM) on the PC speaker involves rapidly toggling the speaker on and off at a high carrier frequency, often around 10-20 kHz on period hardware, to vary the duty cycle—the proportion of time the speaker is active within each cycle—thereby simulating amplitude variations for volume control and generating crude approximations of complex waveforms beyond simple square waves.[19] This technique leverages the binary nature of the PC speaker's output (0 V and 5 V) to mimic analog signals, with the perceived volume being proportional to the duty cycle, ranging from 0% (silent) to 100% (full volume).[20] Implementation relies on software routines executed by the CPU, often using busy-wait loops or timer interrupts to precisely control pulse widths; for instance, to approximate a sine wave, developers employed lookup tables storing precomputed duty cycle values for each audio sample, updating the speaker state accordingly at the desired sample rate.[20] These methods demanded significant CPU resources, as the processor directly handled the modulation without dedicated hardware support.[19] Historically, PWM emerged in 1980s DOS terminate-and-stay-resident (TSR) programs for music playback, exemplified by Access Software's RealSound technology, which enabled 6-bit digitized pulse-code modulation (PCM) audio through the PC speaker for speech and music in games like Mean Streets (1989).[21] The Covox Speech Thing, a PCM DAC released in 1987, achieved 8-bit audio output via parallel port bit-banging, though it required external amplification and was not for the internal speaker. In contrast, pure software PWM on the internal PC speaker powered chiptune effects in titles such as Prince of Persia (1989), where varying duty cycles created dynamic volume envelopes and harmonic timbres for synthesized melodies.[20]Applications
System diagnostics and error codes
The PC speaker serves as a primary auditory interface for system diagnostics in personal computers, particularly during the power-on self-test (POST) executed by the BIOS or UEFI firmware. These beep codes provide immediate feedback on hardware integrity, such as memory, video, or processor issues, when a display is unavailable or non-functional. By generating distinct sequences of short and long tones, the speaker enables technicians to diagnose failures without advanced tools, a practice originating from early PC designs and persisting in legacy modes. Note that beep codes can vary by specific BIOS version and manufacturer; consult the motherboard manual for precise meanings.[22] AMI BIOS employs a standardized set of POST beep codes, using combinations of 1 to 11 short beeps or long-short patterns to denote specific errors, primarily related to RAM and video subsystems. A single short beep indicates a memory refresh timer error, often resolved by replacing RAM or checking the motherboard. Other examples include three short beeps signal base 64K RAM failure, and one long followed by three short beeps points to memory failure above 64 KB. Other examples include eight short beeps for display memory read/write test failure and 11 short beeps for cache memory error. These codes facilitate targeted troubleshooting, such as reseating RAM modules or inspecting video adapters.[23]| Beep Pattern | Meaning |
|---|---|
| 1 short | DRAM refresh timer error |
| 2 short | Parity circuit failure |
| 3 short | Base 64K RAM failure |
| 4 short | System timer failure |
| 5 short | Processor failure |
| 6 short | Keyboard controller Gate A20 error |
| 7 short | Virtual mode exception error |
| 8 short | Display memory read/write failure |
| 9 short | ROM BIOS checksum failure |
| 10 short | CMOS shutdown read/write error |
| 11 short | Cache memory error |
| 1 long, 2 short | Video card memory failure |
| 1 long, 3 short | Memory failure above 64 KB |
