Analog Sensor to Sound Output


I would like to ask if you have any idea how on to generate a sound output proportional to an analog sensor.

I really don't know how to explain it clearly so I included a YouTube link, the one that I am talking about is at 1:55.

A response is greatly appreciated.

Please refer to this at 1:55.

Or any links in this forum that follows the same concept. Thank you very much!!

This uses an IR distance sensor like this one.

You attache it to an analogue input and take a reading.
Then use the map function to get it into the right range.
Then feed the output of the map function to the tone library.