I'm dating myself here but I remember similar techniques back in the original IBM PC days to play sampled audio through the built-in PC speaker: https://en.wikipedia.org/wiki/RealSound
Accessing address 0xC030 (PEEK(-16336) or STA $C030) would cause the machine's internal speaker to click. I assume it was the result of the voltage to the speaker toggling from digital on to digital off.
POKE(-16336) was quieter. I figured it was because it was implemented as a quick read-then-write instruction sequence, too fast for the speaker diaphragm to move end-to-end (effectively a quieter sound). Assembly behavior was different.
In spite of its simplicity, there were games with amazing PWM sound effects (crude by today's standards, but magical in the early 1980s). The software company Muse even produced a sort of speech synthesizer that played sampled words, like an audio version of a ransom note. It sounded wonderfully awful.
The Apple II also had a 1 bit ADC. The cassette audio input is a level/threshold detector and with the right software is able to measure the frequency of pure tones.
I remember finding some little schematic for a DAC and getting the parts at Radio Shack and wiring it up so I could connect the PC to a stereo and play tracker music or something. At least I think it was a DAC. I'm guessing this was before we got the SoundBlaster and Silpheed for Christmas. That was a fun Christmas. Maybe early 90s?