在Android上录制音频而不保存到外部存储

时间:2011-10-27 17:03:04

标签: android audio-recording

我正在将音频写入外部存储设备,但会立即上传该文件然后将其删除。我更愿意只获取音频数据并直接上传,而无需写入SD卡。

这是我目前的代码:

    mRecorder = new MediaRecorder();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    mRecorder.setOutputFile(Environment.getExternalStorageDirectory()
            .getAbsolutePath() + "/filename.3gp");
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

我的setOutputFile来电是否会替换为某种类型的流?

1 个答案:

答案 0 :(得分:1)

Try using Audiorecord

audioRecord = new AudioRecord(android.media.MediaRecorder.AudioSource.MIC,SAMPPERSEC, 
channelConfiguration,audioEncoding,buffersizebytes);
audioRecord.startRecording(); 
mSamplesRead = audioRecord.read(buffer, 0, buffersizebytes); 
audioRecord.stop();