BenF:
Using a 16MHz mcu and bit-bang PWM at 20kHz, you would have 400 instructions available for each interrupt cycle (16e6 / 40e3). This may be achievable (not using the Arduino core), but it doesn't leave you with much for anything else. Direct port IO is 8 bit wide and requires two instructions only. Interrupt overhead is about 50 instructions.
You must help me with this calculation: 16e6/40e3 -> where is the 40e3 coming from.
The only thing the mcu has to do is supply the voltage levels and keep them stable, nothing else.