An on-chip spectroscopic sensor includes a tunable diode laser. A laser driver for drives the tunable diode laser. An analyte test cavity receives a chemical sample and exposes the received chemical sample to light from the tunable diode laser. An optical detector detects light emerging from the analyte test cavity as a result of the laser exposure. A spectral analyzer determines a spectrum of the emerging light, matches and removes one or more known optical fringe patterns from the determined spectrum, and determines a composition or concentration of the chemical sample from the optical fringe pattern-removed spectrum.