MediaRecorder沉默在录音的开头(延迟?)开头、沉默、MediaRecorder

2023-09-05 23:39:59 作者:听佛

我的MediaRecorder是设置记录来自麦克风的音频。这个工程......除了第一0.65秒完全是死气 - 它好像第一0.65秒记录按钮被pssed $ P $,但麦克风没有打开呢。

我需要确定:

在某处有问题,我的code 这是MediaRecorder的工作方式只是一个缺陷 1和2是真实的,但有一个围绕工作 解决方案

RehersalAudioRecord 包含了一些写得很好code,以便记录uncom pressed WAV格式。使用这个,录音不必在开始的死空气。这个类利用AudioRecord,这是一个较低的水平的方法来使用MediaRecorder。使用这个code,例如,做了整合和过渡,从我有超级简单。

这答案让我有......我花了一段时间,发现这个让我张贴这种自我回答的情况下,它加快了别人的code洞穴探险。

This答案是在那里我得到了...

我的解决方案

////////////////////////////

但类只提供原始audio.we无法连接code中的音频文件,准备或MP3等。

My MediaRecorder is setup to record audio from the mic. This works ... except that the first .65 seconds is completely dead air - its as if the first .65 second the record button was pressed but the mic had not turned on yet.

语音有问题

I need to determine if:

Something is wrong with my code This is just a flaw in the way MediaRecorder works 1 and 2 are true, but there is a work around!

解决方案

RehersalAudioRecord contains some very well written code for recording in uncompressed WAV format. Using this, recordings do not have the dead air at the beginning. This class leverages AudioRecord, which is a lower level approach to using MediaRecorder. Using this code as an example made the integration and transition from what I had super straightforward.

This answer got me there ... it took me a while to discover this so I post this self-answer in case it expedites someone's code spelunking.

This answer is where I got my solution from ...

////////////////////////////

But the class only provider a raw audio.we could not encode the audio file to arm or mp3 etc.