Speed of sound and distance measurement