问题描述
我试图基于在什么获取记录在左,右声道的不同过程的音频数据记录和。为此,我正在使用录音类,与MIC输入和立体声模式。
I am trying to record and process audio data based on differences in what gets recorded in the left and right channel. For this I am using Audio Record class, with MIC as input and STEREO mode.
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate,
AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
我的问题是,我得到完全相同的两个声道相同的数据。 (备用样品中分离得到各个通道输入)。请帮忙。我不知道为什么会这样。
My issue is that I get exactly the same data in both the channels. (alternate samples are separated to get individual channel inputs). Please help. I am not sure why this is happening.
推荐答案
下面是一个工作示例用于捕获音频立体声(与三星Galaxy S3 4.4.2 SlimKat测试):
Here is a working example for capturing audio in stereo (tested with Samsung Galaxy S3 4.4.2 SlimKat):
private void startRecording() {
String filename = Environment.getExternalStorageDirectory().getPath()+"/SoundRecords/"+System.currentTimeMillis()+".aac";
File record = new File(filename);
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setAudioEncodingBitRate(128000);
recorder.setAudioSamplingRate(96000);
recorder.setAudioChannels(2);
recorder.setOutputFile(filename);
t_filename.setText(record.getName());
try {
recorder.prepare();
recorder.start();
} catch (IOException e) {
e.printStackTrace();
}
}
如果你的手机支持立体声捕捉,那么这应该工作:)
If your phone supports stereo capturing, then this should work :)
这篇关于音频录制立体声给人的左,右声道相同的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!