functions to write/read complete wav files (16 bit only)