Provided is a spectroscopic apparatus including an encoder configured to output an orthogonal code, a light source configured to receive the orthogonal code and provide to a sample an optical signal encoded as a pattern corresponding to the orthogonal code, a detector configured to detect a output signal emitted from the sample, and a decoder configured to share the orthogonal code with the encoder and extract a valid signal corresponding to the sample based on a correlation between the orthogonal code and the output signal.