trying to reuse found code for wav saving