c@0: function wavwrite(y,varargin) c@0: %WAVWRITE Write an audio file c@0: % c@0: % WAVWRITE is a wrapper function for audiowrite, using the same function c@0: % name and input arguments as the deprecated MATLAB WAVWRITE function. It c@0: % is provided in order to improve the compatibility of legacy code. c@0: % c@0: % WAVWRITE(Y,FILENAME) writes an audio file specified by the string c@0: % FILENAME. The audio data in Y should be arranged with one channel per c@0: % column. The data are assumed to be sampled at 8000 Hz and 16 bits per c@0: % sample. c@0: % c@0: % WAVWRITE(Y,FS,FILENAME) specifies the sample rate FS, in Hertz, of the c@0: % data. c@0: % c@0: % WAVWRITE(Y,FS,N,FILENAME) forces an N-bit file format to be written, c@0: % where N <= 32. c@0: % c@0: % See also AUDIOWRITE. c@0: c@0: % Copyright 2016 University of Surrey. c@0: c@0: % defaults c@0: fs = 8000; c@0: N = 16; c@0: c@0: % determine arguments c@0: switch nargin c@0: case 1 c@0: error('Not enough input arguments') c@0: case 2 c@0: filename = varargin{1}; c@0: case 3 c@0: fs = varargin{1}; c@0: filename = varargin{2}; c@0: case 4 c@0: fs = varargin{1}; c@0: N = varargin{2}; c@0: filename = varargin{3}; c@0: otherwise c@0: error('Too many input arguments') c@0: end c@0: c@0: % write audio file c@0: audiowrite(filename,y,fs,'BitsPerSample',N); c@0: c@0: end