Generation of arbitrarily chirped and CEP-controlled terahertz pulses for dispersion compensation using an optical pulse shaping technique and a fan-out periodically poled crystal.