Generation of terahertz waves by difference frequency generation of mid-infrared radiation