Depending on the used client device, you might actually have something like it already available.
Look for “night mode” or similarly-named options in the settings of your AVR or TV.
I know for certain that the nVidia Shield Pro has something similar available.
If you are using an HTPC for playback, you can extend the player software “Plex HTPC” with an optional compressor An on-demand audio dynamics compressor for PMP and Plex HTPC