android - Continuous recording in smallest file size. AudioRecord or MediaRecorder? -
I'm developing an Android application. In this app, 2 user sends one to talk to each other first user side, audio record of the app records and files recorded on the server you use. On the other hand, the app will download these files and play them using audiotrack. This process is continuous; Which means that I'm recording and sending, while the user is still talking. Everything is working fine, but there is a problem in the size of the files to upload, I found no way to control the size of the recorded files. The whole problem can be solved if I can find audioRecord in a way to use for example. setAudioSamplingRate (low), set lowAudioEncodingBitRate (low), setOutputFormat (OutputFormat.THREE_GPP), setAudioEncoder (MediaRecorder.AudioEncoder.AMR_NB)
I can know that we use these with MediaRecorder, but I To use AudioRecord because I want to analyze the sound before sending it
Here, we have 2 things:. i) or can be MediaRecorder (but instead AudioRecord to use we would lose a voice to recordings continuous way?) ii) or we have to use low-resolution settings in a way
< P> No, what I want to tell AudioRecord is to take care about the sound quality, I want the cheapest in terms of file size. Find my code:Recordings
int frequency = 11025; Int Channel Configuration = Audio Format CHANNEL_IN_MONO; Int audio encoding = audio format. Ncodidiidi bc666; Int buffersize = audio recordcard.GetMinbufresize (frequency, channel configuration, audio encoding); Audio Record Odiorekord = new record audio (Meediarekorder. Awdio Sors.amaisi, frequency, channel configuration, Odioincoding, buffer size); DataOutputStream dos = getDOS (); Int buffer reading = audio record. Raid (buffer, 0, buffer size); For (Int i = 0; i & lt; buffer Reed result; i ++) Doskliteshort (Ank (buffer [i])); //, then upload to server file
Playing
Download // server ... integer intSize = android.media.AudioTrack .getMinBufferSize (11025, audio format. CHANNEL_CONFIGURATION_MONO, audio format.NCODIDIDCB666); Final audiotrack aud = new audiotrack (AudioManager.STREAM_VOICE_CALL, 11025, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, intSize, AudioTrack.MODE_STREAM); Little [] arr = SoundFile2Array (f1); Aud.write (arr, 0, (int) (arr.length)); Text after "text" itemprop = "text"> If I understand correctly you want to reduce data traffic.
I think the problem is that PCM is basically uncompressed audio, which is not great for reducing bandwidth. I do not think that you want to do this, make an encoder For some things like Amar / NB, then upload the encoded data by decryting the feed and output buffers in the encoder by the amount of input buffers to the audio frame.
Comments
Post a Comment