@CrisKH I don't have enough knowledge to help you, but I know two tutorials that may help you:

https://recalbox.gitbook.io/tutorials/audio-video/analog-audio-output-on-pi-zero https://recalbox.gitbook.io/tutorials/audio-video/rotary-encoder-via-gpio-digital-volume-control