samer@43: % rawpipe - audio signal from raw stream from shell pipe samer@0: % samer@0: % rawpipe :: samer@0: % string ~'shell pipe', samer@0: % AudioFormat~'stream format', samer@43: % options(sndstream) samer@0: % -> signal(C,R). samer@0: % samer@0: % If channels or rate are not nan, audio format will be converted to match. samer@0: % If either of them are nan, the corresponding value from the audio file will samer@0: % be left unchanged. samer@0: function s=rawpipe(cmd,fmt,varargin) samer@0: s=sndstream(@pipestream,'stringfn',@()sprintf('rawpipe(''%s'')',cmd),varargin{:}); samer@0: samer@0: function [str,cleanup]=pipestream(q) samer@0: [str,cleanup]=pipein(cmd,q); samer@0: str=javax.sound.sampled.AudioInputStream(str,fmt,-1); samer@0: end samer@0: end samer@0: samer@0: samer@0: