We programmed the Adafruit RP2040 to play music when you hit the keys. It changes octaves when you rotate the rotary encoder.
A quadrature encoder uses two output channels offset in phase to detect both direction and position with greater precision.