Shaping of pulses