Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaRecorder Silence at Beginning of Recording (Delay?)

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:

  1. Something is wrong with my code
  2. This is just a flaw in the way MediaRecorder works
  3. 1 and 2 are true, but there is a work around!
like image 210
Jason Van Anden Avatar asked Oct 28 '10 14:10

Jason Van Anden


1 Answers

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.

like image 86
Jason Van Anden Avatar answered Oct 03 '22 07:10

Jason Van Anden