Would someone please explain how 'gain' functions?


I would appreciate it if someone would explain how gain functions in audio equipment?
I have a 'gain' setting in my phono preamp.  A Gain value (along with loading) is recommended by a cartridge manufacture (MC) for proper function and playback.  So what exactly is 'it' in the electrical world?  What am I changing when I select a particular 'gain'.

When I play my records some are louder on the same volume setting then others.  I find this to be the case on many MFSL and other high quality 180 gram / 200 gram half speed master recordings vs the old school original stamped LP's.

Then there is the difference between loudness of my CD player vs my turntable.  The CD player being much louder than any vinyl playing at the same volume setting.  When I create a CD on my computer with online purchased songs some are very loud and some sound just normal to me at the same fixed volume setting.  I notice the same phenomenon with my Ipod.  Some songs are normal at a volume setting then some songs sound louder.   

I'm not trying to 'fix' anything, just looking for a understandable explanation of the term 'Gain' and how it works.   
Thanks in advance!
quincy
Al, thank you. With my current integrated minimum is at about 6 o'clock and max I don't know. Anything beyond 11 o'clock is unbearably loud with much higher distortion level. My normal range is 7 to 10. So I guess I would be fine if I still used the same amp and speakers.
Hi,  this is Quincy again.

Thanks to all who posted their helpful responses.

So, I have a few more general questions.....

1.  Gain is measured in Voltage dB....what is SPL dB?

2.   Equipment has different Gain voltages.  CD player may have 1 volt.
Why doesn't the pre amp 'level out' or balance all of these different            incoming signals?

4.  Dynamic Range and Dynamic Compression of the signal (Assume both analog and digital) have a major effect on perceived sound levels.  I may have been confusing Gain with these two other items?

5.  On a analog record DR and DC would be either larger or smaller (peak to peak) sound waves embedded in the record groove side walls?

6.  How does DR and DC get put into a digital recording which is really just a bunch of ones and zeros?

5.  Sound is air pressure movement.  How does atmospheric pressure, altitude above sea level, and humidity affect Gain in general?
1) Assuming a speaker is not being overdriven to the point where its behavior becomes significantly non-linear (i.e., "thermal compression" becomes significant), voltage db at any point in the electrical signal path and SPL db produced by the speaker at a given distance will be proportional.

See this writeup for a description of the reference level for SPL db.

2) As I mentioned earlier some preamps provide independently adjustable input level controls. Many and probably most do not, presumably because they would add complexity and cost, and perhaps compromise sound quality. And the user can simply adjust the volume control setting when selecting among different source components.

4) Yes to the statement. Perhaps to the question.

5) Yes.

6) Professional computer-based audio editing programs can easily change the ones and zeros to different ones and zeros corresponding to compression parameters specified by the user.

5) The gains provided by the electronics will not be affected, at least to a degree that is audibly significant. Under some circumstances temperature variations could conceivably affect their gains to at least a slight degree, though. I’m not sure how or if acoustic SPLs might be affected.

Regards,
-- Al
Thanks Al, this helped quite a bit!  
The link was of particular good help as well.
Quincy.