Generation and control of femtosecond pulses by molecular modulation