Esp32 PWM with different on off durations and duty cycle

Finally!
You scope shots explained what you did a poor job of doing in text. You want a 10KHz carrier gated by 2ms ON + 48 ms OFF pulses. The ESP32 can do this in hardware check out its RMT Peripheral.