Android Audio and Video de-echo, noise reduction (Android voice capture and Echo Cancellation) (RPM)

Source: Internet
Author: User



Long time no article, in fact, is to record their own development in the Android growth process. Talking about the audio and video this piece, for the novice just contact this piece, it is very very disgusting ~ I myself get this piece is also from the beginning, in the Internet also read countless information, browse countless blog, tried a variety of methods, online general method is adopted third party, such as WEBRTC, Speex and so on. Even spend money to buy points to the next demo, also found a lot of demo is cheat points, hehe ~ angry ~ Not talk about. The process of growing up is also more difficult, and finally also solve the problem yourself ~ ~ Also hope this article can help in the same situation at the time of my.





1.Android sound recording 1. Using Audiorecord to record sound in Android, recording sound in Android requires the appropriate permissions, note the issue of dynamic request for permissions (more than 6.0).[HTML]View PlainCopy

Handling Permission Request callbacks
@Override
public void Onrequestpermissionsresult (int requestcode, string[] permissions, int[] grantresults) {
LOG.V (TAG, "processing permission request callback");
Permissionutils.requestpermissionsresult (Activitycameraliveview.this, Requestcode, permissions, GrantResults, Mpermissiongrant);
}
Private permissionutils.permissiongrant mpermissiongrant = new Permissionutils.permissiongrant () {
@Override
public void onpermissiongranted (int requestcode) {
Switch (requestcode) {
Case Permissionutils.code_record_audio:
LOG.V (TAG, "permissiongrant:code_record_audio AUDIO = true");
audio = true;
Break
Case Permissionutils.code_read_external_storage:
write_external_storage_permission = true;
LOG.V (TAG, "permissiongrant: write_external_storage_permission = true");
Break
Case Permissionutils.code_stop_camera:
LOG.V (TAG, "Permissionutils.code_stop_camera");
Break
Case Permissionutils.code_write_external_storage:
Break
Case Permissionutils.code_access_coarse_location:
Break
}
}
};

2. The sampling rate needs to be set before recording the Audiorecord [HTML]View PlainCopy
    1. Nminbufsize = audiorecord.getminbuffersize (8000,
    2. Audioformat.channel_in_mono,
    3. Audioformat.encoding_pcm_16bit);

2.Android echo Cancellation There are probably two types of echo cancellation on the Internet: 1. The audio is automatically removed from the voice_communication mode of Android. 2. Use third-party libraries for elimination (WEBRTC, Speex.       ) to eliminate the echo. With third-party words, more trouble, and not good to achieve, with the effect is not very obvious, try a bit Speex, feel mobile phone and mobile phone side voice can also, but if it is mobile phone (APP) and hardware voice, it is necessary to consider the problem of the code stream format, because our company uses the G711 format of the audio stream , so you must first turn the PCM format and then go to the Speex format, and finally to 711 format.         Really not, there is one is in the recording of the force to turn off the speaker, in the recording when the sound of the phone only recorded the voice of the speaker, but the effect is not very obvious, or there will be a noise of AIDS. Turn off the speakers [HTML]View PlainCopy
  1. Audiomanager = (Audiomanager) mcontext.getsystemservice (Context.audio_service);
  2. Audiomanager.setspeakerphoneon (FALSE);
  3. Audiomanager.setstreamvolume (audiomanager.stream_voice_call, 0,
  4. Audiomanager.stream_voice_call);
  5. Audiomanager.setmode (Audiomanager.mode_in_call);


Here I recommend the first method, not only considering the adaptation of the mobile phone model, but also relatively simple to change a parameter:





[HTML]View PlainCopy
    1. Audiorecord = New Audiorecord (MediaRecorder.AudioSource.VOICE_COMMUNICATION, 8000,
    2. Audioformat.channel_in_mono, Audioformat.encoding_pcm_16bit, nminbufsize);
    3. Audiorecord.startrecording ();


There's basically no echo and no noise.




































Http://blog.csdn.net/wl532882877/article/details/78296662?locationNum=5&fps=1



Android Audio and Video de-echo, noise reduction (Android voice capture and Echo Cancellation) (RPM)


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.