大家,我在蓝牙sco录音机上遇到了问题,如果有人可以提供建议我会很感激。
我可以在蓝牙设备上录制声音并将此文件保存在Android手机上,但文件太小,总是小于10kb,可以播放,但我希望它更大更清晰。
这是我的代码:
mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
mAudioManager.setMode(AudioManager.MODE_NORMAL);
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
mAudioManager.setBluetoothScoOn(true);
mAudioManager.startBluetoothSco();
mFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
mFileName += "/voice.wav";
File file = new File(mFileName);
if(file.exists()){
file.delete();
}
mRecorder = new MediaRecorder();
mRecorder.reset();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioChannels(1);
mRecorder.setAudioSamplingRate(8000);
mRecorder.setAudioEncodingBitRate(8);
try {
mRecorder.prepare();
boolean isOn = mAudioManager.isBluetoothScoOn();
if(isOn){
mRecorder.start();
}
} catch (IOException e) {
}