I'm trying to built a circuit that amplifies music from a phone to a headset, based om ambient noise level. So if you're surrounded by noise, your music volume will turn up and in silent surroundings it will turn down.
My problem is that I want to implement a maximum where it stops turning up the volume no matter how much ambient noise there is, to avoid damaging the ears of the user. I think the max volume output (where the graph flattens out) should be in the range of 1-2V. I have included a figure to illustrate what I'm trying to do. I have looked into voltage regulators and I can see that it is quite simple for DC circuits, but not so much for AC circuits. Also, it would be easier to come up with a digital solution, but the learning goals for this semester limits me to work only with analog circuits... Any suggestions?
tl;dr I need an AC voltage regulator for an analog circuit