[Runtimemicro] has the answer, at least if you are writing PWM code for the Arduino. Their free application lets you set a few parameters, visually see the results, and then generates code for you.
Some results have been hidden because they may be inaccessible to you