Speed of Sound Simulator — Wave Propagation in an Ideal Gas
Compute the speed of sound c, target speed at Mach M, Mach cone half-angle and 1 km travel time in real time from heat capacity ratio gamma, molar mass M, temperature T, and Mach number. A spherical wavefront animation and c vs T curves make ideal gas acoustics tangible.
Parameters
Heat capacity ratio gamma
—
Molar mass M
g/mol
Temperature T
K
Mach number
—
Defaults are dry air (gamma = 1.40, M = 28.97 g/mol, T = 293 K). Universal gas constant R = 8.31446 J/(mol K) is used. For Mach > 1 the cone half-angle mu = arcsin(1/M) is shown.
Blue circle = source / white concentric arcs = spherical wavefronts / yellow triangle = source body (faster than sound creates a Mach cone) / red lines = Mach cone (M > 1 only) / cyan text = half-angle mu
Speed of sound c vs temperature T (gas comparison)
X = temperature T (K, 200 to 2000) / Y = speed of sound c (m/s) / blue curve = current gas (gamma, M) / faint curves = H2, He, air, CO2 reference / yellow dot = current (T, c)
Theory & Key Formulas
Sound waves in an ideal gas are adiabatic small perturbations and their phase speed is given by the closed-form expression below.
Here $R = 8.31446$ J/(mol K) is the universal gas constant, $\gamma$ the heat capacity ratio, $M$ the molar mass [kg/mol], and $T$ the absolute temperature [K]. The pressure P does not appear: c depends only on T and M, not on density or pressure.
What the Speed of Sound Simulator does
🙋
In school I learned that the speed of sound in air is about 340 m/s. What conditions does that number assume? Does it change with temperature and gas type?
🎓
Good question. For an ideal gas the speed of sound is c = sqrt(gamma R T / M), where gamma is the heat capacity ratio (about 1.40 for air), R the gas constant 8.314 J/(mol K), T the absolute temperature and M the molar mass. Plug in dry air at 20 C (T = 293 K) and you get 343 m/s; the textbook 340 m/s is just a rounded value. Try gamma = 1.40, M = 28.97 g/mol, T = 293 K in this tool: the panel should show c = 343.1 m/s, about 1235 km/h.
🙋
So is the squeaky helium voice because sound travels faster in helium than in air?
🎓
Exactly. Helium has M = 4 g/mol and gamma = 1.66, giving a room-temperature speed of sound of about 1010 m/s, almost three times that of air. The vocal cord frequency is the same, but the resonant frequency of the vocal tract scales with c (think of a pipe with f = c / (4L)), so the helium voice is roughly an octave higher. Set M = 4 and gamma = 1.66 in this tool to see the change directly. In the comparison plot helium sits second only to hydrogen.
🙋
When I increase Mach from 0.7 to 2.0 the right canvas suddenly forms a triangle. What is that?
🎓
That is the Mach cone, the geometry of a sonic boom. When a source moves faster than sound, the wavefronts bunch behind it into a cone. The half-angle is mu = arcsin(1/M); at M = 2 it is 30 degrees, at M = 5 about 11.5 degrees. The double bang you hear after an F-22 (M about 2) passes is exactly that cone sweeping over you. Try Mach 1.5, 2.0, 3.0 in this tool and watch how mu narrows.
🙋
People say sound is slower at altitude. Is that because the pressure is lower?
🎓
A common misconception, but the answer is no — it is because of temperature. The formula c = sqrt(gamma R T / M) does not contain P; the compressibility and density cancel it. At sea level (15 C, T = 288 K) c is 340 m/s, and near the tropopause (-56 C, T = 217 K) it drops to about 295 m/s, roughly 13% slower. That change is essentially all due to the temperature lapse. Slide T to 217, 288 and 500 K and confirm the sqrt(T) shape on the comparison plot.
Frequently Asked Questions
The ideal gas formula c = sqrt(gamma R T / M) shows that the speed of sound scales as 1/sqrt(M). At the same temperature and the same gamma (about 1.4 for diatomic gases), hydrogen H2 (M = 2 g/mol) reaches about 1310 m/s, roughly four times that of air. Lighter molecules have larger thermal speeds and can carry pressure perturbations faster. Conversely CO2 (M = 44 g/mol) drops to about 270 m/s, which audibly changes the sound of low-register instruments. Move the M slider in this tool to see the dependence directly.
It looks counter-intuitive, but the ideal-gas speed of sound c = sqrt(gamma R T / M) does not contain the pressure P. The reason is that the adiabatic compressibility 1/(gamma P) and the density rho = P M / (R T) cancel the pressure when multiplied. So sea level and the top of Mt Fuji at the same temperature give the same speed of sound. Real altitude variation comes almost entirely from the temperature lapse: in the troposphere c drops about 0.3% per km of altitude, and that correction matters for airspeed measurement.
When a source moves faster than the speed of sound c, the wavefront radius after time t is c t and the source has travelled v t = M c t, so the ratio is 1/M. From the right triangle that this geometry forms, the cone half-angle obeys sin mu = c / (M c) = 1/M, that is mu = arcsin(1/M). At M = 1 the angle is 90 degrees, at M = 2 it is 30 degrees, and at M = 5 about 11.5 degrees. An F-15 at M = 2.5 has a 23.6 degree half-angle, so its sonic boom carpet is several km wide. Set Mach above 1 in this tool to see the cone.
The tool assumes an ideal gas with frozen heat capacities, and matches measurements within 0.5% for dry air between 200 and 500 K. At 293 K (20 C) it gives 343.1 m/s, whereas the JIS B 8005 reference is 343.4 m/s, a 0.1% difference. Humidity (water vapour with M = 18 g/mol speeds up sound), dissociation above 1500 K and quantum effects at very low temperature are all ignored. The accuracy is more than enough for aerodynamic and HVAC sizing, and is a good starting point for preliminary supersonic design.
Real-World Applications
Airspeed calculation and Mach meter: A jetliner Mach meter divides the dynamic pressure measured by the pitot probe by a temperature-corrected speed of sound. At a cruise altitude of 11 km the standard atmosphere gives T about 217 K and c about 295 m/s, so a Boeing 787 at 250 m/s shows M about 0.85. The same airspeed near sea level (T = 288 K, c = 340 m/s) gives only M about 0.74, which is why long-range routes prefer high cruising altitudes. Switch T between 217 K and 288 K in this tool to confirm the difference.
Sonic boom of rockets and supersonic aircraft: When an F-22 (M about 2) or SR-71 (M about 3.2) passes overhead, the Mach cone reaches the ground as a "boom". The half-angle is 30 degrees at M = 2 and only 18 degrees at M = 3.2, so the boom carpet width follows directly from the altitude and sin(mu). NASA's X-59 QueSST is shaped to cut peak boom amplitude by a factor of about eight, and Mach cone visualizations like this one are a starting point for that kind of acoustic design.
Acoustics and instrument design: Pipe organ and wind instrument resonance frequencies f = c/(2L) (open-open) or f = c/(4L) (closed-open) depend directly on the speed of sound. At room temperature c = 343 m/s, an open 1 m pipe gives a fundamental of 171.5 Hz. A cool winter room (T = 283 K, c = 337 m/s) and a warm summer room (T = 303 K, c = 349 m/s) shift the same pipe by 1.7%, which is the physical reason why concert hall tuning gives pianists such a hard time.
Ultrasonic flow meters: Transit-time ultrasonic flow meters infer the flow rate of a gas pipe from the difference in upstream and downstream travel times of sound pulses. The medium speed of sound enters the calibration directly. Natural gas (mainly methane CH4, M = 16 g/mol, gamma = 1.31) propagates at about 450 m/s at room temperature, faster than air, while CO2 is slower at 270 m/s. Setting M = 16 and gamma = 1.31 in this tool gives the methane value used as a starting point for compositional error analysis.
Common Misconceptions and Pitfalls
The most common misconception is that "the speed of sound is higher when the pressure is higher". In reality c = sqrt(gamma R T / M) does not contain the pressure P; only temperature and molar mass enter, because the adiabatic compressibility 1/(gamma P) and the density rho = P M / (R T) cancel P exactly when multiplied. The same air at the top of Mt Fuji (about 0.65 atm) and at sea level has the identical speed of sound at the same temperature. Note that this tool has no "pressure" slider — the omission is deliberate, because pressure is physically irrelevant.
Next is the belief that "the Mach number is an absolute speed". Mach number is the ratio M = v / c, and c itself depends on the environment (T, gamma, M). The same Mach 1.0 at sea level (c = 340 m/s) and in the stratosphere (c = 295 m/s) corresponds to absolute speeds about 50 m/s apart. Mach 25 of a re-entering Space Shuttle at 80 km altitude is a different physical regime from a hypothetical Mach 25 at sea level. Switch T between 200 K and 500 K in this tool and you will see v at Mach 0.8 change accordingly.
Finally, people sometimes assume "there is a discontinuity in sound speed at Mach 1", but c = sqrt(gamma R T / M) is a continuous function that does not depend on Mach. Increasing Mach changes only the source velocity and the geometry of the wavefronts, not the medium's sound speed. The Mach cone appears across M = 1 because that is when the source overtakes its own wavefront, but the medium itself remains continuous. Sweep the Mach slider through 0.9, 1.0 and 1.1 and verify that c is unchanged while the cone appears or disappears.