Acoustic Velocity with Temperature and AppleScript

NOTE: visit https://www.github.com/kreivalabs for the current code version.


UPDATE – additional user prompt to enter the measured distance (in feet) between the reference speaker and delay speaker. This version will round all returned values to two decimal places, for convenience. If you require a more precise measurement, you can delete the rouding functions in the final “display dialog” line.

#A utility to calculate approximate acoustic velocity in air based on measured temperature in

#degrees Fahrenheit, as well as approximate speaker delay timings in milliseconds based on the

#measured distance between loudspeaker systems.

#Created to simplify the process of setting speaker delay timings for indoor performances of

#theater and small to mid-sized concerts in the absense of an RTA software package.

#Note: these calculation cannot take into account the ideal gas law and therefore do not reflect 

#air pressure or gas molecular density. The returned results are sufficient for most indoor

#measurements.

try

display dialog "Enter temperature in degrees Fahrenheit" default answer "" with title "Acoustic Velocity Calculator"

 set myTemp to text returned of result as number

display dialog "Enter measured distance between speakers in feet" default answer ""

 set myDistance to text returned of result as number

on error errmsg number errnbr

 my error_handler(errnbr, errmsg)

 return

end try

ignoring numeric strings

 set myCelcius to (myTemp - 32) * 5/9 as number

 set metersSeconds to (0.606 * myCelcius) + 331.3 as number

 set feetMiliseconds to metersSeconds * 0.00328084 as number

 set delayTime to myDistance / feetMiliseconds as number

end ignoring

display dialog "Approximate Acoustic Velocity is " & ((round (metersSeconds * 100)) / 100) & " m/s, or " & ((round (feetMiliseconds * 100)) / 100) & " ft/ms. Approximate delay time is " & ((round (delayTime * 100)) / 100) & " ms." as text

ORIGINAL – On a recent job I had to calculate acoustic velocity to set speaker delays without access to a true RTA. I’m not a big fan of the one-millisecond-per-foot “rule” for anything other than quick mental calculations independent of production conditions. I would rather be more accurate. So, utilizing the following equation to calculate acoustic velocity based on measured temperature in degrees Celsius:

Acoustic Velocity (m/s) = 331.4m/s + (0.6 * temperature Celsius)

I use a digital temperature meter to get degrees Fahrenheit (a better measurement for calculations in the States) and convert as follows:

(Degrees Fahrenheit – 32) * 5/9 = Degrees Celsius

Plug the Celsius value into the equation above to return acoustic velocity in m/s based on measured temperature (because as we know, air temperature determines acoustic velocity).

Then, put that measurement into something more useful, like ft/ms, which is what a standard speaker processor will be looking for.

Take your m/s value and multiply by 0.00328084

Once you know the distance in feet between your zero reference and your delay speaker, multiply that by the ft/ms value above to get your ms offset for the delay. Of course, this will not be perfectly accurate as it can’t take into account air density, just temperature. For indoor use, it’s still pretty good and certainly better than one-millisecond-per-foot.

To make the whole process a bit easier, I wrote some AppleScript that prompts for a temperature value, then returns acoustic velocity in m/s and ft/ms, as below:

try

display dialog "Enter temperature in degrees Fahrenheit" default answer "" with title "Acoustic Velocity Calculator"

 set myTemp to text returned of result

on error errmsg number errnbr

 my error_handler(errnbr, errmsg)

 return

end try

ignoring numeric strings

 set myCelcius to (myTemp - 32) * 5/9

 set metersSeconds to (0.6 * myCelcius) + 331.4

 set feetMiliseconds to metersSeconds * 0.00328084

end ignoring

display dialog "Approximate Acoustic Velocity is " & metersSeconds & " m/s, or " & feetMiliseconds & " ft/ms." as text

return

Paste the code above into AppleScript editor and run it, or save it as an application to use again.

Source available at https://github.com/kreivalabs/acousticVelocityAndDelay-AppleScript