kailash09dabhi / OmRecorder

A Simple Pcm / Wav audio recorder with nice api. https://play.google.com/store/apps/details?id=com.kingbull.omrecorder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recording Wav/PCM last 1 second being missed in saved audio file

viju2008 opened this issue · comments

I am using the OmRecoder.pcm with 16KHZ sample rate and 16 bit PCM with skip silence options as default.

Sometimes i have noticed that the last 1 seconds in a 8-9 seconds total audio is missed when the wav file is saved.

Can u guide me whether I am doing anything wrong.
Regards,

Code that I am using

recorder = OmRecorder.wav(
new PullTransport.Noise(mic(),
new PullTransport.OnAudioChunkPulledListener() {
@OverRide public void onAudioChunkPulled(AudioChunk audioChunk) {
animateVoice((float) (audioChunk.maxAmplitude() / 200.0));
}
},
new WriteAction.Default(),
new Recorder.OnSilenceListener() {
@OverRide public void onSilence(long silenceTime) {
Log.e("silenceTime", String.valueOf(silenceTime));
Toast.makeText(WavRecorderActivity.this, "silence of " + silenceTime + " detected",
Toast.LENGTH_SHORT).show();
}
}, 200
), file()
);

@nonnull private File file() {
return new File(Environment.getExternalStorageDirectory(), "demo.wav");
}

return new PullableSource.Default(
new AudioRecordConfig.Default(
MediaRecorder.AudioSource.MIC, AudioFormat.ENCODING_PCM_16BIT,
AudioFormat.CHANNEL_IN_MONO, 16000
)
);