Better wave header writing