Topic: Combining Software Channels to Single Hardware Pin Output
Firstly, hey 1-bit music forum. First post, long-time lurker.
Okay, so I'm trying to combine a bunch of software timers, generating variable width pulse functions, into a single output pin. I've posted the topic here because I'm currently using an ATMega128, but the question's probably hardware agnostic.
I can easily bit bang multiple pins and combine the output electronically (in the subsequent analog domain), just, it's a bit inelegant and I'm stumped as to combining them in software (without using PWM to emulate an analog waveform, which is cheating). The problem is, when I get multiple channels to flip the pin, I usually get a resultant single pitch with unwanted duty cycle modulation, which sounds cool but not really what I'm after. This is minimised with simple frequency ratios such as 2:1 or 3:2, but even 5:4 or 6:5 will fail to create polyphony.
How is this done on other 1bit platforms? Is there a solution? I personally cannot see how discrete pitches can be preserved when each interacts with the other, especially when I only have two states. The vital high-time of one wave is flipped to low for another, affecting the perceived pitch. I also have no idea how pulse and noise could be run simultaneously on a single pin without only noise audible.
Would XORing the channels help? Perhaps using pin pulse modulation to minimise duty cycle interaction?
Any thoughts would be much appreciated.