Coherent millimetre wave to mid-infrared measurements with continuous bandwidth reaching 40 THz