I daresay that this can be done with a Raspberry Pi as well, or it can be connected to an XBMC media centre running on the Pi, so I’m featuring it here.
This is an Instructable on creating an Arduino device that detects the volume level of a television and then automatically issues infra-red signals to turn the volume up or down.
Read the Instructable here. Let me know if you get it working with a Pi!