rework WAV writer a bit and add 12-bit PCM support