% sndpipe - pipe reader implementation of sndstream
%
% sndpipe ::
%    string     ~'shell pipe'
%    options {
%       channels :: natural/nan ~'desired number of channels';
%       rate     :: nonneg/nan ~'desired sampling rate';
%       bits     :: natural/16 ~'desired bits per sample';
%    }
% -> signal(C,R).
%
% If channels or rate are not nan, audio format will be converted to match.
% If either of them are nan, the corresponding value from the audio file will
% be left unchanged.
function s=sndpipe(cmd,varargin)
	s=sndstream(@pipestream,'stringfn',@()sprintf('sndpipe(''%s'')',cmd),varargin{:});

	function [str,cleanup]=pipestream(q)
		[str,cleanup]=pipein(cmd,q);
		str=austream(str);
	end
end



