Back in the Apple ][ days, the timing for writing to the cassette port and to the speaker were identical (just poking different addresses), so you could load audio from cassette using the ROM routines to read a program from tape, then use a modified routine that wrote to the speaker address instead of the cassette port address to play back the audio at 1-bit quality. It kind of sounded like something recorded off AM radio.
I also remember a lot of experimenting with timing to try to get a simulation of polyphonic sound by trying to toggle the speaker at the zeros of sin aθ + sin bθ.