Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PC speaker
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Pulse-width modulation== The PC speaker is normally meant to reproduce a [[Square wave (waveform)|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 (signal processing)|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 [[pulse-code modulation|PCM audio]]. (A more refined version of this technique is used in [[Class-D amplifier|class D]] [[audio amplifier]]s.) With the PC speaker this method achieves limited quality playback, but a commercial solution named [[RealSound]] used it to provide improved 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 electricity transmission|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 ([[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 [[Audio bit depth|bit depth]]). The clock rate of the PC's [[programmable interval timer]] which drives the speaker is fixed at 1,193,180 Hz,<ref name="pit" /> and the product of the audio sample rate times the maximum DAC value must equal this. Typically, a 6-bit DAC<ref>{{Cite web |last=Leonard |first=Jim |date=2022 |title=IBM PC Sound Ramblings - The Best Sound You've Never Heard |url=http://www.oldskool.org/sound/pc/#digitized |access-date=2022-08-31 |website=The Oldskool PC}}</ref> with a maximum value of 63 is used at a sample rate of 18,939.4 Hz, producing poor but recognizable audio.<ref>{{cite web |author=Schlunder |first=Edward |date=2006-11-18 |title=Resistor/Pulse Width Modulation DAC |url=http://www.k9spud.com/digital-to-analog-converters/resistor-pwm |archive-url=https://web.archive.org/web/20170317074148/http://www.k9spud.com/digital-to-analog-converters/resistor-pwm |archive-date=2017-03-17 |website=K9spud Microcontroller Electronics}}</ref> 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|moving-iron]] speaker (often confused with [[Piezoelectric loudspeaker|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 card]]s.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)