Improve WAV file parsing