【问题标题】:Thick slow recorded sound using android recorder使用android录音机录制的厚厚的慢速录音
【发布时间】:2012-04-02 08:59:29
【问题描述】:

我正在开发一个使用 Mediarecorder 类录制声音的 Android 应用程序 以下是我的代码的一部分:

  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);
recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioEncodingBitRate(16);
recorder.setAudioSamplingRate(44100);
try {
    recorder.setOutputFile(path);
} catch (IllegalStateException e) {
    e.printStackTrace();
}
recorder.prepare();
recorder.start();


}

当录音机停止时,我使用 mediaplayer 类播放它,但结果声音很厚而且很慢......可能是什么问题?

【问题讨论】:

    标签: android recorder


    【解决方案1】:

    根据 MediaRecorder documentation,AMRNB 的采样率为 8kHZ,您将其设置为不同的值。我怀疑这是问题所在。

    您能否评论这些行并检查是否适合您:

    //recorder.setAudioEncodingBitRate(16); 
    //recorder.setAudioSamplingRate(44100); 
    

    【讨论】:

    • 不,我试图评论这些并在真实设备上尝试过......但同样的问题
    • 你用的是什么设备?
    猜你喜欢
    • 2016-03-26
    • 2018-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多