function Y = mp3streamout_open(FNAME,SR,CH)
% Y = mp3streamin_open(FNAME,SR,CH)
%    Open a stream to write out MP3 data to MP3 file FNAME.
%    Y returns a handle to pass to mp3streamout_write.
%    SR, CH specify the sampling rate and #chans of the data.
% 2014-02-19 Dan Ellis dpwe@ee.columbia.edu

if CH == 1
  MONOOPT = ' -m m';
else
  MONOOPT = '';
end

cmd = ['lame -r',MONOOPT,' -s ',num2str(SR),' - ',FNAME];
%disp(cmd);
Y = popenw(cmd);
