Continuous recording in smallest file size. AudioRecord or MediaRecorder?
$30-250 USD
Closed
Posted over 9 years ago
$30-250 USD
Paid on delivery
I am developing an Android application. In this app, 2 users talk to each other (simulating normal phone call). At the side of 1st user, the app records using AudioRecord and sends recorded audio to the server. At the other side, the app will download these files and play them using AudioTrack. This process is continuous; which means I keep recording and sending while the user is still talking. Everything is working fine but I have a problem with the size of the files to upload. I did not find a way to control the size of the recorded files. The whole problem can be solved if I can find a way to tell the audioRecord to use for example: setAudioSamplingRate(low), set lowAudioEncodingBitRate(low), setOutputFormat(OutputFormat.THREE_GPP), setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB).
I know we can use these with MediaRecorder, but I have to use AudioRecord because I want to analyze the sound before sending it.
Here, we have 2 solutions:
i) either to use MediaRecorder instead of AudioRecord (but can we keep recording in continuous way so that no sound will be lost?)
ii) or we find a way to tell AudioRecord to use the low-resolution settings
I don't care about the quality of the sound, I want the cheapest in terms of file size. Find below my code:
Recording
int frequency = 11025;
int channelConfiguration = AudioFormat.CHANNEL_IN_MONO;
int audioEncoding = AudioFormat.ENCODING_PCM_16BIT;
int bufferSize = [login to view URL](frequency, channelConfiguration, audioEncoding);
AudioRecord audioRecord = new AudioRecord([login to view URL], frequency, channelConfiguration, audioEncoding, bufferSize);
DataOutputStream dos = getDOS();
int bufferReadResult = [login to view URL](buffer, 0, bufferSize);
for (int i = 0; i < bufferReadResult; i++) [login to view URL](enc(buffer[i]));
//Upload file to the server
Playing
//download from server, then ...
int intSize = [login to view URL](11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT);
final AudioTrack aud = new AudioTrack(AudioManager.STREAM_VOICE_CALL, 11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, intSize, AudioTrack.MODE_STREAM);
short[] arr = SoundFile2Array(f1);
[login to view URL](arr, 0, (int)([login to view URL]));
What I need is a way to Record sound to an array. Then i analyze / change data in this array, save it to a file, upload the file, then download it at the other side, retrieve original array, and play it. I could do all of this and it is working very well. All what I need is a way to minimize the file size. I want a way to tell the audioRecord to record using 3gp format, for example, or any other cheap format.
Again, I want to keep recording and lose nothing. I want to record and send while the user is still talking. The app should keep recording without losing any audio. I don't want to record and save to a file. I want to record, get an array, play with it, save it to a file, and upload the file. All of this has been successfuly done. I tried to zip/compress the file that includes the manipulated array, the compressed file was only 10% smaller.
hi,
I can do this job . So much jobs here on freelance and bids, and little responces...
will correctly estimate after you just shoot a message to me.
About experience: i have job history on eLance_peopleperhour_oDesk coms.
I have done such app but only fo recording dial ta;k and saved it in 3gp format.
Regards,Iskandar
You can create in your app a comprimer and it will comprime automatically for you...But it's not that simple to do that..Let's just have a conversation and see what we can do!I can start right now!