Various improvements and fixes for SoX wrapper.