title: How to record audio using matlab from IP android camera
body: <p>I am trying to save audio and image from android camera to my computer in the local network using IP webcam and Matlab. </p>
  
  <p>The android application allows me to access different resources using featuring URL addresses:</p>
  
  <ul>
  <li>live streaming video: 192.168.0.105:8080/videofeed </li>
  <li>live streaming audio in wav: format 192.168.0.105:8080/audio.wav</li>
  <li>take one picture frame: 192.168.0.105:8080/shot.jpg</li>
  </ul>
  
  <p>I have succeed to save images to matlab using this function  (it also displays images as video in real time):</p>
  
  <pre><code>function save_screen
  url = 'http://192.168.0.105:8080/shot.jpg';
  ss  = imread(url);
  FileNum = 1;
  fh = image(ss);
  while(1)
      pause(1)
      ss  = imread(url);
      set(fh,'CData',ss);
      drawnow;
      fname = ['Image' num2str(FileNum) '.jpg'];
      imwrite(ss, fname, 'JPG');
      disp(['image saved ' fname]);
      FileNum = FileNum + 1;
  end
  </code></pre>
  
  <p>Now, same as with images, I am trying  to  save audio from URL stream in sequences of 30 seconds  e.g. audio1, audio2, etc; in order to analyze it further in matlab. I have tried this with no success:</p>
  
  <pre><code>url = 'http://192.168.0.105:8080/audio.wav';
  ss  = wavread(url);
  FileNum2 = 1;
  fh = wavread(ss);
  while(1)
      pause(1)
      ss  = wavread(url);     
      wavwrite(ss,fname);
      disp(['Sacuvava se audio ' fname]);
      FileNum2 = FileNum2 + 1;
  end
  </code></pre>
  
  <p>So to conclude, the main problem is to save 30 seconds audio sequences from URL. Any help highly appreciated</p>