Frequency modulation for continuous wave terahertz spectroscopy