separated WAV stuff from sgen