2012-03-30 81 views
0

现在我正在开发一个Android应用程序来录制语音。我通过使用下面的代码来做到这一点。android录音音量变化

m_recorder.setAudioSource(MediaRecorder.AudioSource.MIC); 
    m_recorder.setOutputFormat(OutputFormat.THREE_GPP); 

    m_recorder.setAudioEncoder(AudioEncoder.AMR_NB); 
// m_recorder.setAudioEncoder(MediaRecorder.getAudioSourceMax()); 
    m_recorder.setAudioEncodingBitRate(128); 
    m_recorder.setAudioSamplingRate(44100); 

    m_recorder.setOutputFile(Environment.getExternalStorageDirectory() + "/audio.3gp"); 
     try { 
      m_recorder.prepare(); 
      m_recorder.start(); 
     } 

但被我越来越低容积sounds.I问题曾经在网上搜索solution.All我得到的是

“有没有办法做到这一点,同时记录 - 但同时播放,您可以使用MediaPlayer上的setVolume(float,float)方法。“ ”。

但是我必须将录制的剪辑上传到服务器。所以有什么方法可以将低音量的声音剪辑转换为高音量剪辑吗?

回答

-3

我用这个代码,记录和保存文件和它的工作对我来说:

    recorder = new MediaRecorder(); 
        FileOutputStream fos = openFileOutput(fileNameStr, 
          MODE_PRIVATE); 

        recorder.setAudioSource(MediaRecorder.AudioSource.MIC); 
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 
        recorder.setOutputFile(fos.getFD()); 
        recorder.prepare(); 
        recorder.start(); 
+0

就是在我们的代码有什么区别? – sarath 2012-03-30 12:57:41

+0

这些行做了什么m_recorder.setAudioEncodingBitRate(128); m_recorder.setAudioSamplingRate(44100); – Goofy 2012-03-30 13:26:20

+0

我用这条线来改善声音质量......我尝试了ur代码....那是什么filenamestr变量?... – sarath 2012-03-30 13:28:21