The speed of sound varies depending on the medium through which the sound waves pass. It is usually quoted in describing properties of substances (e.g. see the article on sodium).
More commonly the term refers to the speed of sound in air. The speed varies depending on atmospheric conditions; the most important factor is the temperature. The humidity has very little effect on the speed of sound, while the static sound pressure (air pressure) has none. Sound travels slower with an increased altitude (elevation if you are on solid earth), primarily as a result of temperature and humidity changes. An approximate speed (in metres/second) can be calculated from:

where
(theta) is the temperature in degrees Celsius.
A more accurate expression is

where R (287.05 J/kgK for air) is the universal gas constant R divided by the molar mass of air, κ (kappa) is the adiabatic index (1.402 for air), sometimes called γ, and T is the absolute temperature in kelvin. In the standard atmosphere:
T0 is 273.15 K (= 0°C = 32°F), giving a value of 331.5 m/s (= 1193.4 km/h = 741.541 mph = 643.95 knots).
T20 is 293.15 K (= 20°C = 68°F), giving a value of 343.421 m/s (= 1139.319 km/h = 768.209 mph = 667.109 knots).
T25 is 298.15 K (= 25°C = 77°F), giving a value of 346.338 m/s (= 1246.818 km/h = 774.732 mph = 672.774 knots).
In fact, assuming a perfect gas the speed of sound depends on temperature only, not on the pressure. Air is almost a perfect gas. The temperature of the air varies with altitude, giving the following variations in the speed of sound using the standard atmosphere (actual condititions may vary)
| Altitude | Temperature | m/s | km/h | mph | knots |
| Sea level | 15°C (59°F) | 340 | 1225 | 761 | 661 |
| 11000m-20000m (Cruising altitude of commercial jets, and first supersonic flight) |
-57°C (-70°F) | 295 | 1062 | 660 | 573 |
| 29000m (Flight of X-43A) | -48°C (-53°F) | 301 | 1083 | 673 | 585 |
In fluids, using the theory of compressible flow, the speed of sound can be calculated using

This is correct for adiabatic flow; Newton famously used isothermal calculations and omitted the κ from the numerator.
In an ideal gas the speed of sound is really only dependent on the temperature and not of air pressure. Air is nearly an ideal gas. Notice: Therefore the speed of sound is independent on air pressure.
In solids the speed of sound is given by:

where E is Young's modulus and ρ (rho) is density. Thus in steel the speed of sound is approximately 5100 m/s.
For air, see density of air.
The speed of sound in water is of interest to those mapping the ocean floor. In saltwater, sound travels at about 1500 m/s and in freshwater 1435 m/s. These speeds vary due to pressure, depth, temperature, salinity and other factors.
| Impact of temperature | |||
| °C | v in m/s | ρ in kg/m³ | Z in N·s/m³ |
| - 10 | 325.4 | 1.341 | 436.5 |
| - 5 | 328.5 | 1.316 | 432.4 |
| 0 | 331.5 | 1.293 | 428.3 |
| + 5 | 334.5 | 1.269 | 424.5 |
| + 10 | 337.5 | 1.247 | 420.7 |
| + 15 | 340.5 | 1.225 | 417.0 |
| + 20 | 343.4 | 1.204 | 413.5 |
| + 25 | 346.3 | 1.184 | 410.0 |
| + 30 | 349.2 | 1.164 | 406.6 |
Mach number is the ratio of the object's speed to the speed of sound in air (medium).