使用MediaRecorder在android上录制声音

使用MediaRecorder在android上录制声音,android,audio,recorder,Android,Audio,Recorder,我正在开发一个android应用程序,它使用AudioRecorder类录制声音 以下是我的代码: public void start() throws IOException { String state = android.os.Environment.getExternalStorageState(); if(!state.equals(android.os.Environment.MEDIA_MOUNTED)) { throw new IOExcep

我正在开发一个android应用程序,它使用AudioRecorder类录制声音 以下是我的代码:

  public void start() throws IOException {
    String state = android.os.Environment.getExternalStorageState();
    if(!state.equals(android.os.Environment.MEDIA_MOUNTED))  {
        throw new IOException("SD Card is not mounted.  It is " + state + ".");
    }

    // make sure the directory we plan to store the recording in exists
    File directory = new File(path).getParentFile();
    if (!directory.exists() && !directory.mkdirs()) {
      throw new IOException("Path to file could not be created.");
    }
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
System.out.println("mashi");
recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioEncodingBitRate(16);
recorder.setAudioSamplingRate(44100);
try {
    recorder.setOutputFile(path);
    System.out.println("ooutput");
} catch (IllegalStateException e) {
    e.printStackTrace();
}
recorder.prepare();
recorder.start();
}

录制的声音很慢而且很粗!!
问题是什么?

将recorder.setAudioSamplingRate(44100)更改为recorder.setAudioSamplingRate(8000);因为在emulator中,8000采样率不超过此值