Automatic volume control?

Hello,
would something like a automatic volume control be possible?
For example;
you use a headphone plug from say an ipod, have the arduino measure the current or voltage, then adjust a digital potentiometer which controls the volume of a pair of earphones so that volume can't reach above X number of dB.

flaxen

If you only ever used the same set of headphones, but different headphones have different sensitivities, so the same electrical stimulus may result in completely different loudness.

Similar circuits can be found in TVs, in an attempt to keep commercials from being too loud.
Always resulted in loss of high end in the program material to my ears tho.

What you might do instead is "normalize" your music collection instead so all songs have the same volume levels.
Probably have similar affect on the higher frequency tho.
Or, maybe it will not be noticable if have lower resolution (128K) anyway.

What you are after for the music coming out of your box is a compression circuit that compresses the higher volume levels down while not impacting the rest.
google "audio sound compressor", do some reading.

http://www.audioforge.ca/content.php?tc=20&mg=134

"Simply put, when a signal’s level exceeds the set threshold, the compressor activates and begins lowering the volume."

Yes indeed - can probably find same in a guitar compressor pedal.