MediaRecorder 录制开始时静音(延迟?)
我的 MediaRecorder 设置为从麦克风录制音频。这很有效……除了前 0.65 秒完全是死气沉沉的 - 就好像前 0.65 秒按下了录音按钮,但麦克风尚未打开。
我需要确定是否:
- 我的代码有问题
- 这只是 MediaRecorder 工作方式中的一个缺陷
- 1 和 2 是正确的,但有一个解决方法!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RehersalAudioRecord 包含一些编写得非常好的代码,用于以未压缩的 WAV 格式进行录制。利用这一点,录音就不会一开始就死气沉沉。此类利用 AudioRecord,这是使用 MediaRecorder 的较低级别方法。使用此代码作为示例使我的集成和转换变得非常简单。
这个答案让我到达那里......我花了一段时间才发现这一点,所以我发布了这个自我答案,以防它加快某人的代码探索。
这个答案是我从...得到解决方案的地方
// ///////////////////////////
但是该类仅提供原始音频。我们无法将音频文件编码为arm或mp3等。
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.