The ideal gas law is based on a simple picture of a gas as a large number of molecules which move independantly of one another, except for occasional collisions with each other or with the walls of their container. When they do collide, the collision occurs with no net loss of energy -- that is, it is an elastic collision.
The ideal gas model predicts that the speed of sound in a pure gas will be
For comparison the "root mean square" (or "rms")
velocity of the molecules in an ideal gas, an appropriate average
for the speed of molecules in the gas, is given by
For air, which is a mixture of molecules, you will need to use average values for the adiabatic constant and molecular mass. Air is mostly N2 and O2, which are both simple diatomic molecules with almost the same masses. The adiabatic constant will be very close to 1.4 for both molecules for a wide range of temperatures near room temperature (graph). Hence the adiabatic constant will also be close to 1.4 for air. The average molecular mass will depend on the air composition which changes slightly, for example due to day to day variations in relative humidity. For 100% relative humidity under normal room conditions, about 2% of the molecules of air are water molecules. Since the mass of a water molecule is almost half that of an oxygen or nitrogen molecule, the larger the humidity the lower the density of the air for the same pressure and temperature. At or near room temperature the fraction of air which is water is small, and so the effect will not be large. Some very small variations can be expected for other variations in air content, such as in CO2 content. CO2 molecules are about 50% heavier than O2 and N2 molecules and so will increase the density. The fraction of air which is CO2 is so small (0.04%) that the effects due to CO2 are very small as well. For air expelled from human lungs, however, the CO2 concentration is typically 4 to 5%, with a corresponding decrease in O2 concentration, and that can cause effects comparable to changes in humidity.
The temperature dependence and the change in density due to changes in composition, the latter almost entirely due to changes in humidity, are by far the two largest causes for variations in the speed of sound in air. Note, however, that humidity is normally expressed as a percentage of the maximum concentration for the air. That maximum may change with conditions. What matters for the speed of sound is the fraction of the air molecules which are water (i.e. the "molar fraction"). The molar fraction corresponding to 100% humidity will depend on temperature and pressure (see graph). Hence there may be an apparent dependence on pressure when the water content is expressed as a percent relative humidity rather than a molar fraction. For example, if you take 20 oC air at 1 atm and 100% humidity and remove half of the molecules, you end up with air at 0.5 atm and about 50% relative humidity, not 100% humidity. Hence to look at the changes due only to changes in pressure, and not molecular composition, you would need to compare air at 1 atm and 100% humidity with air at 0.5 atm and 50% humidity.
There are some additional small effects related to the details of the exchange of energy between the molecules. These effects give rise to non-ideal gas behavior. In particular, they can cause disipation of sound energy (that is, the sound energy is turned into heat energy). For normal atmospheric conditions, the effects on the speed of sound are very small, but can also give rise to very small variations in the speed of sound with frequency. For a comprehensive discussion of these and other effects, see the reference below.
Here are some graphs illustrating how the speed of sound in real air depends on temperature, pressure, humidity and frequency. Data for these graphs is from tables contained in the reference below. Note that a pressure of 0.5 atm corresponds to an altitude of just under 6,000 m (20,000 ft) above sea level and 20 oC is "room temperature" (20.00 oC = 293.15 K). Day to day changes in atmospheric pressure due to weather are about plus or minus 5% (e.g. from about 0.95 to 1.05 atmospheres at sea level).
For more information on the ideal gas law, the specific heat ratio, etc., use your favorite internet search engine (or, if you really want to know, take some physics classes). Here is a separate table for the speed of sound in other gases.
Reference: "Handbook of the Speed of Sound in Real Gases," by A. J. Zuckerwar (Academic Press, 2002).
Questions/Comments to: email@example.com