1. A keyboard unit comprising: a key; at least one displacement member which is configured to be driven directly or indirectly with the key by a pressing operation of the key to be moved in a forward stroke direction; a detector including, as object detection sections, at least three detection sections including: a detection section, a state of which becomes a state change detection state when detecting a change in a state of the key; and a detection section, a state of which becomes a state change detection state when detecting a change in a state of the displacement member; and a generator, in a case that states of all the object detection sections become the state change detection state in the forward stroke of a key pressing operation, which is configured to obtain detection results of at least two sets of the detection sections, each set including two object detection sections, which is configured to select at least one of the obtained detection results of the at least two sets of the detection sections, and which is configured to generate sound generation indication information based on the selected at least one of the detection results.