It is only natural to think this would work. It appears to comply with the concepts of transistor gain.
However your schematic will only work during the signal's positive waveform.
Screenshot:
As soon as the signal goes negative, the transistor gain drops.
-----------------------
What about adding a transistor in parallel, to conduct in the opposite direction?
I tried simulating a few combinations of NPN, PNP, orientation, bias direction, etc.
Couldn't find one that works. None seem to provide current flow both ways, as well as smooth gain adjust.
-----------------------
Consider using an FET-based volume control:
https://freecircuitdiagram.com/2012/01/11/voltage-controlled-attenuator-volume-control-using-fet/
Or a photo-resistor:
https://www.instructables.com/id/Make-a-Voltage-Controlled-Resistor-and-Use-It/