Modulation cancellation method in laser spectroscopy