Modulation of terahertz emission in time-domain waveform via a photoinduced phase transition in a charge ordered organic ferroelectric