I suggest "return distance / 5.0;" for everything between 1.0 and 0.05. That gives about the same values as now for the hardcoded switch points, but leads to a more smooth adaptation of the speech delay instead of having it "jump" at the switch points.