This is one of my older projects that aims to control external devices directly, by using the PC Speaker port. It can control multiple devices at one go, but they must be powered one at a time. I made it a couple of years ago and it was working fine, but due to mistake during plugging it literally burned ;(
Now, when both cheap USB chips are available and PC speaker is unused (or integrated with sound card) it doesn't make sense, to build it, but this is still an interesting concept.
The device is plugged instead of system speaker, it uses drive power connectors as a source of voltage. Each try to play a sound is interpreted as a signal, this signal is increasing 4017 counter, when it counts to 3, it resets itself to 0.
For every state, 4017 has a separate pin, for example, when it counts to 3, only Q3 pin is set to the high state, when it counts to 1, only Q1 pin is set to high. To each of those pins we may plug devices, they can't take too much current, otherwise we will need to add to this circuit transistors (base plugged to 4017's pin, emitter to GND, collector to GND pin of plugged device, VCC of device plugged to Vcc of our circuit).
After computer is turned-on, device plugged to Q0 is powered, when we want to power device plugged to Q2, we need to send two signals to PC Speaker, this will turn-on Q1 for a short time, and after that Q2. By involving additional logic on the software side, we may use this behaviour, to control all plugged devices.
Unfortunately, I don't remember, what was the values of used elements.
What is the easiest way, to play a sound on mentioned port? On older computer it can be done by "displaying" bell character on STDOUT. It's presented on below snippet.
To create driver for this device, there are also needed some delays, variable that store actual high pin and some way to get data from the user.