I don't think you can use this to directly change the volume (that needs a voltage/current change) ( I'm sure some one will correct me) but you could change the tone according to the input.
Code to play tune (according to my notes):
https://web.archive.org/web/20140117015124/http://ardx.org/src/circ/CIRC06-code.txt
Mark