How to control the volume of speakers by using sensors?

I am about to start a project however I have very very little experience with Arduino's, I was wondering how you could control the volume of speakers by using a sensor. The idea was that as people get closer to the sensor the volume of the speaker increases, and decreases as they move away. (Ideally on other sides of the room). Any help would be much appreciated! (The budget is also quite small). Thank you!

The HCSR04 ultrasonic rangefinder is pretty cheap and easy to use. A library is available here. The disadvantages may be the lack of range (10 feet max, in my experience, with hard target) and the fact that people are "soft" targets (not great ultrasound reflectors).

As to volume control will depend on the sound output hardware. Don't know what you are using so can't comment.