2 ms·
The PC speaker was driven by square waves, therefore there was no way to alter the audio volume, or change its sound. Only frequency could be altered, literally
by squarefoot 5y ago
The PC speaker was driven by square waves, therefore there was no way to alter the audio volume, or change its sound. Only frequency could be altered, literally by inverting the pin status N times a second. Then it came the PWM idea, and hackers found the way to implement analog sounding audio through it (the same principle used to fade a led through a GPIO). The port became a DAC, audio levels were encoded through PWM, and the speaker inertia made for a crude but effective Nyquist-like filter.
Having full hardware access to the port, the nastiest thing one could do is to keep the speaker on fixed DC by setting the port to a digital value (that is, 1 or 0) and never changing it. PWM ensures that sometimes the speaker isn't driven, which reduces the average current, and therefore the load from the driver perspective, but now we're making current flow through it continuously. Will that destroy it? I don't know, but to my knowledge it seems the only way one can abuse it, or the port that drives it. It all boils down to current limiting circuitry; if it's present, then I guess there's no way to damage either the speaker or the driving port.