title: Android - AudioRecord splitting of 2 channels in channel_in_stereo
body: <p>I came across this link but I am not sure how to implement it 
  <a href="https://stackoverflow.com/questions/20594750/split-two-channels-of-audiorecord-of-channel-in-stereo">split two channels of AudioRecord of CHANNEL_IN_STEREO</a></p>
  
  <p>I want to separate the data received in the left and right channel</p>
  
  <p>Below is my code </p>
  
  <pre><code>for(int i = 0; i &lt; read/2; i = i + 2)
  {
      leftChannelAudioData[i] = data[2*i];
      leftChannelAudioData[i+1] = data[2*i+1];
      rightChannelAudioData[i] =  data[2*i+2];
      rightChannelAudioData[i+1] = data[2*i+3];
  }
  </code></pre>
  
  <p>Full source can be found here: <a href="http://pastebin.com/ntm1mHG0" rel="nofollow noreferrer">http://pastebin.com/ntm1mHG0</a></p>
  
  <p>I have tried from line 298 to line 322 but it does not work. It crashes my application instead :/</p>
  
  <p>Thanks all!</p>