Improve precision of formant detection and fix a division by zero bug