Writing wave file output