A video of this demonstration is available at this link.

A signal generator sends a 20-Hz square wave to a loudspeaker driver, at the left end of the glass tube in the photograph above, and provides a synchronous trigger to the oscilloscope. A microphone at the end of a long metal rod allows you to probe inside the tube, anywhere along its length. The microphone is connected to an input of the oscilloscope, and when the square wave reaches it, you see the resulting pulse on the oscilloscope trace, at some delay with respect to the trigger. If you measure this delay with the microphone at two different distances from the speaker, you can then use the distance and delay differences to calculate the speed of sound.  You can also fill the tube with helium and repeat the measurement, to compare the speed of sound in helium to that in air.

With the signal generator producing a square wave, the microphone circuit produces a pulse with the leading edge of each cycle. Placing the microphone right against the output grille of the speaker shows that there is a roughly 210-μs delay within the speaker housing. Measuring the distance from the flat face of the speaker housing might account for this delay fairly well, but, of course, measuring from the grille and then subtracting 210 μs from the travel time eliminates it. The best way to eliminate the error, though, is to measure the delay for two well-defined references some distance apart along the length of the tube, and then to divide this distance by the difference between the two delays.

Sound waves are longitudinal waves created by a disturbance in an elastic medium. The oscillatory motion of the particles transmitting the wave is parallel to the axis along which the wave travels, as opposed to that in a transverse wave, in which it is perpendicular to the direction in which the wave travels. In this case, the elastic medium is, of course, air or, if you fill the tube with helium, helium.

To obtain an expression for the speed of sound in a gas, we can imagine the gas occupying a long cylinder of cross-sectional area A, and an oscillating piston at one end of the cylinder sending a wave through the gas. With each cycle, the cylinder compresses a portion of the gas, increasing the pressure and density in it above the equilibrium pressure and density. As the gas moves away from the piston, it compresses layers of gas next to it, and a pulse, in the form of a region of high pressure and density, travels down the cylinder. When the piston moves back to its initial position, the gas in front of it expands, creating a region where the pressure and density are lower than the equilibrium pressure and density. Thus, a sequence of alternating regions of higher-than-normal pressure and density, compressions, and regions of lower-than-normal pressure and density, rarefactions, travels down the cylinder.

Now we imagine a single pulse, a compression, being sent down the tube, and assume that it has well-defined edges and uniform density and pressure. In the frame of reference of the pulse, as it travels through the tube, gas is coming toward it at velocity v. If we take a thin slice of the gas, as it enters the region where the pulse is, its leading face is at higher pressure than its trailing face, so it is compressed and decelerated. The pressure difference across it is dp, and its velocity inside the pulse region is v + dv. (dv is negative.) When it emerges from the other side of the pulse region, it experiences the reverse pressure difference, expands and is accelerated to its original velocity, v.

When the plug of gas enters the region where the pulse is, then, it feels a force of F = dpA. As the plug travels down the tube, its length is v dt, where dt is how long it takes for the gas plug to pass a particular point in the cylinder. Its volume is thus Av dt, and its mass is ρ0Av dt, where ρ0 is the equilibrium density of the gas. So by Newton’s second law, F = ma, we have dpA = (ρ0Av dt)(-dv/dt), which we can rearrange to ρ0v2 = (-v dp/dv). In entering the pulse region, the gas plug is compressed from its equilibrium volume V0 = Av dt by an amount dV = A dv dt. Rearranging this gives (dV/V0) = (A dv dt/Av dt) = (dv/v).

So ρ0v2 = (-v dp/dv) then becomes ρ0v2 = (-V dp/dV). ), The quantity on the right, the ratio of the change in pressure on a body to its fractional change in volume (it is the same as (-dp/(dV/V)), is called the bulk modulus of elasticity B of the body. It is positive, because the volume changes in the opposite direction to the pressure. In terms of B, the speed of our pulse is v = √(B0).

Now we need to know what dP/dV equals. Newton, in his calculation of the speed of sound in air, used Boyle’s law (pV = k, or pV = p0V0). This assumes that the temperature in the gas does not deviate from its equilibrium temperature. This condition does not hold in our sound wave. In regions of compression, the gas has had work done on it, and so is hotter than before, and in rarefactions, the gas has expanded and cooled by the same amount that the compression regions have heated. Heat does not have enough time to travel from the compressions to the rarefactions and thereby keep the gas at its equilibrium temperature. This means that the difference between the equilibrium pressure and the pressure in a compression region is greater than we would expect from Boyle’s law (as is that between the equilibrium pressure and the pressure in the rarefactions), and this results in a higher velocity. For Newton, this resulted in an error of about 15% in his calculation. We must use instead the adiabatic gas law, which states that pVγ = p0V0γ, where γ is the heat capacity ratio, CP/CV. This is the ratio of heat capacity at constant pressure to heat capacity at constant volume. So p = p0V0γV. Differentiating and then setting V = V0 gives dp/dV = -γ p0V0γV-(γ-1) and V0(dp/dV)0 = -γp0. So the bulk modulus for an ideal gas is γp0. Substituting this into the equation in the previous paragraph gives ρ0v2 = γp0. The speed of sound in a gas is thus v = √(γp00). For an ideal gas, p0 = nRT/V. Since n = m/M, that is, total mass divided by molar mass, and ρ = m/V, ρ0 = p0M/RT, and v = √(γRT/M). For air at STP (0 °C and 1 atm), γ = 1.40, and v = √((1.40 × 8.314 J/mol·K ×273.16 K)/(2.8967 × 10-2 kg/mol)) = 331 m/s.

If we call room temperature 298 K, the speed of sound works out to 346 m/s.

For helium, of course, both γ and M are different. γ = 1.67, and M = 4.003 × 10-3 kg/mol. So for helium the equation above gives v = 973 m/s at STP, and 1,020 m/s at 298 K. Since the speed, frequency and length of a sound wave are related by the equation ν = v/λ, the frequency of a sound produced by a resonator of a particular length is proportional to the speed of sound in the particular gas that fills the resonator. This is why when you inhale helium from a balloon, the pitch of your voice rises so dramatically. Since the speed of sound in helium is almost triple that in air, the frequency of your voice almost triples when your airway is filled with helium.

References:

1) Resnick, Robert and Halliday, David. Physics, Part One (New York: John Wiley and Sons, 1977), pp. 434-436, 510-514.
2) Crawford, Frank S., Jr. Waves: Berkeley Physics Course – Volume 3 (San Francisco: McGraw-Hill Book Company, 1968), pp. 165-169.