Convert linear voltage to PWM
Yes, basically make a sawtooth and feed that to a comparator. The venerable 555 can do this, although rather crudely. See here: https://www.falstad.com/circuit/e-555pulsemod.html

The key to making a good sawtooth is to use a current source to charge the cap. This makes the linear ramp, improving the accuracy of your PWM.

Another way to make a PWM modulator is to use a square wave generator followed by an integrator fed into the comparator.  Example here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/4362. However I foresee issues with that approach in getting the DC offset right - always a problem with integrators.

You could ‘cheat’ and use a microcontroller to sample the analog waveform and convert that to PWM via software. I suspect that’s not the point of this question.