Refactored Audio I/O code.