0

I am doing voice recording application on android using AudioRecorder Class and have worked with different Sample Rates 44100,32000,24000,16000 and 8000. The Sample Rate 44100 gives good quality audio but it takes very large size but other samples rate give bad and very bad quality audios with acceptable file sizes.

Before you say Possible of duplicate questions i have seen the following Links:

Link1

Link2

But the referred links are different from question.

my questions is how to get good quality audio with small file size for the sample rates such as 32000,24000 and 8000?

or Is there any way compress the wav file from large size to small one?.

my code sample:

tempbufferSize = AudioRecord.getMinBufferSize(16000,AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT);
........
mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,16000, AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT,tempbufferSize);
mAudioRecord.startRecording();
.....

i have refered the Link.

please help me.

Community
  • 1
  • 1
M.A.Murali
  • 9,988
  • 36
  • 105
  • 182

2 Answers2

0

You do realize that when you increase the sample rate you get more samples per second and that effectively increases the size of the file. The approach is more quality, more data.

Some references for compression:


http://www.eetimes.com/design/analog-design/4017792/Audio-Compression-Algorithm-Overview

http://jspeex.sourceforge.net/index.php

http://flac.sourceforge.net/license.html <-- BSD license / lossless

http://jflac.sourceforge.net/ << Apache license / lossless

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
0

WAV is pure uncompressed audio data so without sacrificing quality, file sizes will be quite large. You could record to MPEG4 using MediaRecorder and setOutputFormat()

Look at:

MediaRecorder

OutputFormat MPEG4

Hope that helped

gcb
  • 366
  • 5
  • 16
  • Actually, I see that link 2 in your question uses MediaRecorder. Does this not solve your problem? – gcb Aug 06 '12 at 13:22
  • I need pause and resume features in audio recording thats why i do not go ahead with MediaRecorder. is possible to combine mp4 files while pause and resume?. if this is possible please tell me some samples?. please – M.A.Murali Aug 06 '12 at 13:28
  • I see. It does have Start and Stop features, but after calling Stop you have to reconfigure it as if you were starting again. You could concatenate the files after each session. Another option is to record in WAV and then after you have finished, use JLayer to convert the WAV file to MP3. JLayer: http://www.javazoom.net/javalayer/javalayer.html – gcb Aug 06 '12 at 13:39
  • please tell me how to concatenate the files after each session for Mp4 files using MediaRecorder. it would help me a lot. – M.A.Murali Aug 06 '12 at 13:43
  • the mpeg-4 spec is http://mpeg.chiariglione.org/standards/mpeg-4/mpeg-4.htm#10.9 here. You would have to know the file header structure, which i'm really not sure about. – gcb Aug 06 '12 at 14:07
  • You could also use 3GPP, which I think might be easier. Again, you will have to find out the header format. – gcb Aug 06 '12 at 14:10