code to generate wave files