Control of amplifier gain

Would it be possible to use the arduino PWM for this function?

No, because the PWM switching fequency will get coupled into your audio signal. PWM is not a real analog voltage signal, it's a digital signal that switches on and off rapidly to simulate an analog signal, when averaged.