Basically, not an Arduino/ microcontroller topic. Unless there is some major non-linearity issue that requires the computing power of a microcontroller, this is something you do with an op-amp.
Now note that for this sort of thing where you need to drive significant (well,modest) current, a likely suitable op-amp is an LM386! ![]()