A self-calibrating key sensor system is constituted by an optical
modulator, optical position transducers, a data accumulator and a data
analyzer, and the optical modulator has a gray scale section to produce a
key position signal varied together with the keystroke and an absolute
data section to produce a calibration signal representative of a strictly
adjusted distance between transparent areas of the absolute data section;
the data accumulator accumulates discrete values of the calibration
signal and discrete values of the key position signal together with the
sampling time, and the data analyzer determines the gradient of the key
position signal on the basis of peaks of the calibration signal produced
at both ends of the strictly adjusted distance so as to estimate the true
distance between the rest and end positions.