... and it has to added that with a rotary decoder one need to distinguish between incremental and absolute decoders. From the intended application it seems that absolute position of the decoder is needed (otherwise you can add to, e.g., a position of 128 (could be maximum volume), an other 128 - which wouldn't make sense and software then has to take care for. Potentiometer as proposed by @liamobsolete might be the better solution.
Besides, mechanical inkremental decoders are cheaper than optical ones, but bring the problem of bouncing. Reading those decoders is a little tricky - the internet is full with proper treatment.