If you only use a few speeds to cover your jobs I wonder if a relay module board with each relay connected to a trim pot and resistor pair from a 10v supply (each of which was fine tuned to give the right volts for that speed) could be used?
I guess you would need a gcode command in the code to switch the right relay on instead of the speed command. Just a different take on it.