【发布时间】:2016-04-18 01:59:54
【问题描述】:
我是 android 新手我想将 .raw 文件转换为 .mp3 请帮我转换它。 我的代码是。
private void initRecorder() {
int bufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT);
mBuffer = new short[bufferSize];
toTransform = new double[bufferSize];
mRecorder = new AudioRecord(MediaRecorder.AudioSource.MIC, SAMPLE_RATE, AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
}
if (!mIsRecording) {
Log.e("bbkk", "KKBB");
mIsRecording = true;
mRecorder.startRecording();
mRecording = getFile("raw");
startBufferedWrite(mRecording);
}
private File getFile(final String suffix) {
Time time = new Time();
time.setToNow();
return new File(Environment.getExternalStorageDirectory(), time.format("%Y-%m-%d-%H-%M-%S") + "." + suffix);
}
【问题讨论】:
-
没有错误,但是,我需要使用 .read 方法,但 MediaRecorder 不支持。 #Vishal Raj
标签: java android android-activity converter audio-recording