The automatic musical instrument contains a main body provided with a
sliding saddle member and a sliding operation piece. The sliding
operation piece is provided with a reflecting pattern consisting of light
reflecting regions and light absorbing regions. The sliding saddle member
is provided with a infrared emitting diode and two phototransistors
inside. When the sliding operation piece is slidably moved in contact
with the sliding saddle member, infrared light emitted from the infrared
emitting diode is reflected by the reflecting pattern. Then, the
phototransistors receive the reflected light and output pulse signals A
and B. The high speed processor built in the main body calculates the
sliding speed, the sliding direction and the sliding time on the basis of
the pulse signals A and B. Also, the high speed processor controls the
movement of the character image displayed on the screen on the basis of
one of the sliding speed, the sliding direction and the sliding time.