我正在开发一个需要以 16khz/16bits/mono(1 通道)录制 PCM 音频的应用程序。它在摩托罗拉 ATRIX 上完美运行,但在 HTC One 上整个文件的录音断断续续。我认为这是因为它仍在尝试以立体声录制但为第二个通道写空白。如果我录制立体声效果很好,但我需要单声道。
有没有人听说这是一个问题?由于时间限制,无法将轨道从立体声混合到单声道。
private static final int RECORDER_SAMPLERATE = 16000;
private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_MONO;
private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
private void startRecording()
{
int bufferSize = AudioRecord.getMinBufferSize(RECORDER_SAMPLERATE, RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING);
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
RECORDER_SAMPLERATE, RECORDER_CHANNELS,
RECORDER_AUDIO_ENCODING, bufferSize);
recorder.startRecording();
isRecording = true;
recordingThread = new Thread(new Runnable()
{
public void run()
{
try {
writeAudioDataToFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}, "AudioRecorder Thread");
recordingThread.start();
}