News for hackers. Stuff that matters.
Re:Donkey – A computer game included with early versions of ... by HeyLaughingBoy on Monday July 18, 2016 @10:23AM (#12115176)
PC had a speaker hooked to a TTL port, with the same engineering sophistication as the backup alarm on a garbage truck

While true, the quality of sound achievable this way is a matter of software. There are many programs that achieved excellent sound quality, playing music even with just a speaker and a TTL drive.

Remember, the simplest DAC is PWM into a low-pass filter.

Re:Donkey – A computer game included with early versions of ... by kragen on Monday July 18, 2016 @01:25PM (#12116556)
A couple of years back, I burned out a friend's tweeters by hooking up an Arduino's 31.25kHz PWM to his stereo system. Worked fine at first, but it eventually melted his tweeters. I figured the stereo would low-pass-filter the input for me, and I paid the price.

The PC speaker didn't have PWM; it had a square-wave generator with adjustable frequency. Very few 1980s programs achieved anything even approaching decent sound quality using the PC speaker, although by the 90s, CPUs were fast enough that it was reasonably feasible. In the late 90s, I used to patch my Linux kernel with an unofficial driver that provided arbitrary PCM output via the PC speaker. It was glitchy if I left interrupts disabled during IDE disk accesses, which was the default at the time due to some buggy IDE devices that would sometimes corrupt data if you didn't. Fortunately, mine wasn't one of them.

I feel like PDM is just as simple as PWM and often gives better quality, and an R-2R DAC like a Covox is arguably just as simple as PWM and gives dramatically better quality. You need a few more pins, though, or a 74595.

Re:Donkey – A computer game included with early versions of ... by HeyLaughingBoy on Monday July 18, 2016 @03:54PM (#12117680)
Interesting!

I must be thinking of a different computer then. Perhaps my Radio Shack CoCo. I remember some small computer from the mid-late 80's producing really good music with just a logic output driving the speaker. Was sure it was the IBM/clone.

One of the nice things is that I have original cloth-bound IBM PC 5150 Technical Manuals in my basement so I can actually go look up the schematics of what's driving the speaker :-)

Re:Donkey – A computer game included with early versions of ... by kabdib on Monday July 18, 2016 @11:05PM (#12119285)
Well, maybe. It's still bang-bang control, and to get decent quality you'd have to dedicate the processor to bit-banging the port. With the Mac you just filled in a buffer that got DMA'd along with the video. Not great, but at least you could do waveforms using a slice of the CPU.

The PC was built to beep, and that's about it. Anything you got out of it past that was painful and used a lot of CPU.