Android语音通话录音问题。。。。audiosource.voicecall无法正常工作
我想用安卓系统做电话录音机。我有以下代码,当我使用 MediaRecorder.AudioSource.VOICE_DOWNLINK | MediaRecorder.AudioSource.VOICE_UPLINK正在录制通话,但播放时无法理解。如果将相同的代码用于AudioSouce.MICAndroid语音通话录音问题。。。。audiosource.voicecall无法正常工作,android,android-mediarecorder,Android,Android Mediarecorder,我想用安卓系统做电话录音机。我有以下代码,当我使用 MediaRecorder.AudioSource.VOICE_DOWNLINK | MediaRecorder.AudioSource.VOICE_UPLINK正在录制通话,但播放时无法理解。如果将相同的代码用于AudioSouce.MIC 那么录制的文件是可以理解的。 这是我的密码 package com.example.callrecoder; import java.io.File; import java.io.IOExceptio
那么录制的文件是可以理解的。 这是我的密码
package com.example.callrecoder;
import java.io.File;
import java.io.IOException;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button record_call = (Button)this.findViewById(R.id.record);
final Button stop_recorder = (Button)this.findViewById(R.id.stop);
final MediaRecorder _recorder = new MediaRecorder();
record_call.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
//MediaRecorder _recorder = new MediaRecorder();
try {
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(Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/sam.wav").getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Path to file could not be created.");
}*/
//_recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL );
_recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_DOWNLINK | MediaRecorder.AudioSource.VOICE_UPLINK );
_recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
//_recorder.setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath()
// + "/test.wav");
_recorder.setOutputFile("/sdcard/sample.3GPP");
_recorder.prepare();
_recorder.start();
} catch (Exception e) {
e.printStackTrace();
}
}
});
stop_recorder.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
try
{
_recorder.stop();
_recorder.reset();
_recorder.release();
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
//_recorder = null;
}
});
}
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}
我想用AudioSource.downlink和uplink录制通话。
请帮我解决这个问题。我正在Samsang Galaxay Gio手机上测试 使用语音识别代替语音呼叫
callRecorder = new MediaRecorder();
callRecorder.reset();
callRecorder.setAudioSamplingRate(8000);
callRecorder.setAudioEncodingBitRate(12200);
callRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION);
callRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
callRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
你说的“不可理解”是什么意思?它以错误的速率播放?或者听起来像是随机垃圾?很有可能你在录制语音通话时收到的是AMR编码的数据,所以你使用的播放器可能有AMR音频问题?顺便说一句,你应该使用语音通话,因为你需要上行和下行(虽然不是所有设备都支持)。VOICE_UPLINK | VOICE_DOWNLINK不等于VOICE_CALL,因为它们不是位掩码。AMR编码的数据是什么意思?我的意思是用@MAsim编码的数据。您的问题有解决方案吗?同样的问题。录制的语音不清晰…使用.AMR作为录制文件的扩展名