title: How to encode Recorded voice to ogg vorbis?
body: <p>I have recorded voice with android AudioRecord and I would like to convert it to ogg vorbis as it is patent free. I have try vorbis-java beta, but it seem not work or I make some mistake.</p>
  
  <p>Here are my code :</p>
  
  <pre><code>int     frequency     = 44100;
  int     channel       = AudioFormat.CHANNEL_IN_STEREO;
  int     mAudioSource = MediaRecorder.AudioSource.MIC;
  int mAudioEncoder = AudioFormat.ENCODING_PCM_16BIT;
  try {
              final File outputFile = new File(mOutputPath);
              DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile)));
              int bufferSize = AudioRecord.getMinBufferSize(frequency, channel, mAudioEncoder);
              AudioRecord audioRecord = new AudioRecord(mAudioSource, frequency, channel, mAudioEncoder, bufferSize);
              short[] buffer = new short[bufferSize];
              audioRecord.startRecording();
              while (isRecordStart) {
                  int bufferReadResult = audioRecord.read(buffer, 0, bufferSize);
                  for(int i = 0; i &lt; bufferReadResult; i++) {
                      dos.writeShort(buffer[i]);
                  }
              }
              audioRecord.stop();
              dos.close();
          }
          catch (FileNotFoundException e) {
              e.printStackTrace();
          }
          catch (IOException e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>I save it to a file with extension wav and use example of vorbis-java to encode, but output is only zzz.......</p>
  
  <p>How to encode this to ogg vorbis in android?</p>