For all practical purposes it varies with temperature only. The reason for this is that the speed that a wave (such as sound, light is a different category) will propogate through a medium (such as air) is related to the elasticity of that medium and not its density. Pressure doesn't affect the elasticity except to the extent that is affects the termperature.
Temperature is far and away the primary factor. It is also influenced by the ratio of the specific heats (gamma) of air which may be affected by pressure, but the effect would be very small unless you were dealing with a large temperature change.
The most general formula for the speed of sound is
a = ((gamma)*R*T)^1/2
a - speed of sound
gamma - ratio of the specific heats
R - Gas Constant
T - Temperature
^1/2 - square root
Gamma and R are normally taken as constants, so that leaves temperature as the only variable.
Another way of looking at it is that temperature is a measure of the speed of the average molecule of air. So, as the temperature increases the speed of the average molecule increases and thus the speed at which a wave can propogate is increases.
Density is only an issue as it pertains to what the medium is. The speed of sound is faster with hydrogen than air, for example, due to hydrogen being less dense. It is important to notice that the speed of sound INCREASES with DECREASING density, while it also INCREASES with INCREASING temperature. This is all in a gas, incidentally. The speed of sound in a solid object is not particularly affected by the temperature as the elasticity is due to atomic properties and not molecular motion.
This elasticity can be thought of as a "restoring" force, bringing the object or fluid/gas back to its original state. The faster this happens the faster sound will travel. The stiffer the substance is the faster it restores so the faster sound travels. Stiffness refers to the change in pressure due to a change in volume.
Elasticity, therefore, is related to temperature for a particular gas or the inter-atomic forces in a solid object.
Sound is directly proportional to the stiffness and inversely proportional to the density. The only way to change the density in this sense is to change the gas itself. If you decrease the density, all else equal, the sound will move faster. This is why people sound funny when they've inhaled helium.
The original equation posted by sstearns2 is correct. The "R" in the equation is the gas constant for that particular substance. You are thinking of the Universal Gas Constant, denoted by an "R" with a bar above it. The equation is "
R = R(bar)/molecular weight
a= ((gamma)*R*T)^1/2 is the correct equation for the speed of sound in a gas
For practical applications of Aerospace engineering, gamma is equal to 1.4 unless high-speed aerodynamics is being studied (such as flow around the shuttle during re-entry) where ionization changes the molecular characteristic significantly.