Simple things always tend to get complicated...
I wanted to update my 'Still Alive' Arduino demo. This currently uses a simple square-wave on pin 8 to generate a melody. I wanted to make a simple change so that I could also play a bassline on the same output pin as the melody.
Chop-mix between two square waves (with different frequencies) to produce two clean, clear tones at the same time. It's as simple as outputting one cycle of square-wave at frequency A followed by one cycle at frequency B.
Unfortunately, it sounds horrible in practice. It just doesn't work.
Rather less simple.
Use a high-frequency PWM and let the speaker perform crude filtering. This gives a rudimentary Digital to Analogue converter. Produce two notes by mathematically mixing their waveforms.
Fortunately, this method works really well. It's more complex that the 'chopping' idea, but it's worth it. I've now got a two-channel, envelope shaped, wave-table audio output from a single pin.
I'm hoping to get it polished and scrunched back into the demo soon. The addition of a bassline really makes a huge difference. [edit: Here's the youtube video]
Oh, and because anything is more interesting if it's got a picture, here's a graph from my waveform generating spreadsheet...