So, I was trying to mess with noise cancellation on my arduino (I think I did it wrong now that I remember) but at the time I was wondering if it was feasible to generate a pseudo-sine (or triangle) wave (but mostly sine

) by rapidly switching PWM duty cycle. I know a 16mhz AVR can do PWM at 8mhz(fixed), which is plenty fast enough for these purposes, but I'm more concerned about the duty cycle switching speeds. Basically my idea would take 2 PWM pins per speaker, and maybe an h-bridge. Basically you set one pin to ground, and the other you rapidly adjust the PWM duty to simulate the changing values of a sine wave. Let's assume we want a frequency limit of 10khz, and to generate one of those sine wave parabolas we want 10 different values (this would be pretty low resolution) over a single half-wave (one parabola). We could use a super-low-pass filter cap to smooth it out. To get the other parabola (on the opposite side of the x-axis) we have to reverse the pin orientation so the other one is ground and the one that used to be ground is now doing the PWM. We would again have to make those 10 different PWM values to simulate the parabola. This means for each cycle, we need 20 separate PWM values (remember, that's an arbitrary value). If we're at 10khz, that's 200khz duty cycle switching. Is this doable? Switching the PWM level 200 thousand times a second? Would this idea even work :-? ?

-will