CrossRoads, thanks, but thats not really what im looking for. Space is limited so I would like to do it mostly in code. I'm leaning towards the using a transistor in series with the pwm output to the speaker, and then mapping a separate photoresistor input that outputs to the base of the transistor... though im not really sure how to work that out since I'm new to electronics and cant bias a transistor yet. I also saw this
http://arduino.cc/forum/index.php/topic,36857.0.html, but it confuses me a bit and i'm not sure how i would use it. What I really want is to use all code: no transistor, no amplifier. Using light sensitivity to control the volume is also vital and it probably needs to be calibrated so i can get full control. Is that possible?