I have a Ruud Ultra Series modulating gas furnace that requires a special thermostat for most efficient operation. (I think you can also operate it as a two-stage furnace with reduced efficiency.) The modulating thermostat outputs a pulse-width modulated signal on its ‘V’ terminal that controls the gas valve on the furnace over a 40%-100% power range. According to the thermostat manual, “Amplitude of this signal is about 10 VDC, frequency is 1 Hz, and the pulse width is variable 350 to 950 [milliseconds] in steps of 50 msec.” See page 7 of the manual at this link. The controller built into the furnace sets the blower speed as appropriate for the burner heat output level.
Sounds like a simple Arduino or Raspberry Pi project, with the appropriate 24 VAC and 10 VDC interfaces