2012-04-01 9 views
0

使用してアンドロイドに聞こえる私のコードから、次のとおりです。録音は、私がAudioRecorderクラス を使って音を記録アンドロイドアプリケーションを開発していMediaRecorder

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(); 

}

録音した音声は非常に遅く、厚いです!! 何が問題ですか?

答えて

1

変更recorder.setAudioSamplingRate(44100)to recorder.setAudioSamplingRate(8000);エミュレータではそれがかかります8000サンプリングレートこれ以上ではありません..

関連する問題