Improve error handling and efficiency of audio file utils.