title: How to extract part of recorded audio bytes
body: <p>I recording sound to byte array, see below:</p>
  <pre><code>    recorder = new MediaRecorder();
      recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
      recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
      recorder.setAudioSamplingRate(44100);
      recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
      recorder.setAudioEncodingBitRate(1024*1024);
  </code></pre>
  <p>...</p>
  <pre><code>    while (hasRecording) {
          try {
              int read = inputStream.read(data, 0, data.length);
              if (read == -1)
                  break;
  
              byteArrayOutputStream.write(data, 0, read);
              byteArrayOutputStream.flush();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  <p>By recording I am drawing amplitude to chart (on the fly). After stop recording user can select part of chart. And now, how can I extract part of byte array by the user selection? I have only position selected coords and byte array of completed recorded sound.
  I know, that I have to calculate with bitrate for gets position in byte array, but I don't know how.</p>
  <p>Thanks.</p>