Generalized envelope equation for studying sub-cycle dynamics and multiple-harmonic spectral broadening in highly nonlinear waveguides