Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Acoustic Echo Cancellation does not working #157

Open
jameszhong2008 opened this issue Dec 31, 2019 · 17 comments
Open

Acoustic Echo Cancellation does not working #157

jameszhong2008 opened this issue Dec 31, 2019 · 17 comments
Labels
enhancement New feature or request

Comments

@jameszhong2008
Copy link

Use MixedReality-WebRTC and test it on a PC, seem like the Echo cancellation has no effect(echo and
howling sound). Is there anyway to turn it on or adjust it?

@djee-ms
Copy link
Member

djee-ms commented Jan 2, 2020

Hi @jameszhong2008, I thought AEC was always active by default in Google's code, but I have to admit I never really looked into the details. We don't currently expose any audio settings; this will likely change with the introduction of standalone track objects (#152) but this is not available yet. I need to try to reproduce that issue, but I won't be able to do so until I'm back in the office next week, sorry for the delay. In the meantime you can try locally to change the audio options passed to the audio engine when created the track:

pc_factory->CreateAudioSource(cricket::AudioOptions());

You can pass a custom cricket::AudioOptions instance and try forcing echo_cancellation=true, and maybe even extended_filter_aec=true and/or delay_agnostic_aec=true too, although I would try with the former only first.

@jameszhong2008
Copy link
Author

@djee-ms, thanks a lot, I pass AudioOption forcing echo_cancellation=true seems no difference. then I pass extended_filter_aec=true, still have howling sound, then I add delay_agnostic_aec=true. there is no howling sound but some of the voice was lose and some lower noisy sound occured. any suggestion? sorry for my bad english.

@djee-ms
Copy link
Member

djee-ms commented Jan 6, 2020

Sorry I never tried AEC myself and I'm not an audio expert. It seems that the issue is more with the AEC experience itself, rather than with MixedReality-WebRTC. Could you maybe try to get in touch with the WebRTC folks directly and ask them? I would understand that MixedReality-WebRTC can potentially change the the audio timing, but if you have problems even with delay_agnostic_aec=true then it sounds like this is a more general issue with AEC itself, and not with MixedReality-WebRTC. Of course we can discuss adding more audio options if you find what option helps in your case.

WebRTC bug tracker : https://bugs.chromium.org/p/webrtc/issues

Note: I remember reading that if you ear an acoustic echo issue on one peer, then the problem is AEC on the other peer. Did you change the options on the correct peer? On both?

@jameszhong2008
Copy link
Author

Yes, I change both side, about the lower noisy sound , I add noise_suppression=true then it disappeared.
With delay_agnostic_aec=true, I changed position of the microphone, echo cancellation effect is better than before. thank you.

@djee-ms djee-ms added the enhancement New feature or request label Jan 7, 2020
@djee-ms
Copy link
Member

djee-ms commented Jan 7, 2020

I'll mark this issue as a feature request to expose the audio options then.

@kspark-scott
Copy link

Coincidentally, we (Kognitiv Spark) noticed the lack of echo cancellation in mid-December 2019 (even though it has been present in every previous version, including our original uwp-sdk m62 build). I can confirm that explicitly setting the cricket::AudioOptions() addresses our issue as well, so we would also like to see this feature added.

For the record, I found that setting echo_cancellation=true was not sufficient on its own. Setting either delay_agnostic_aec=true OR extended_filter_aec=true alone was sufficient to remove the echo, though with delay agnostic AEC I could still hear faint traces of an echo from time to time. Extended filter AEC was impressive and seems to remove it completely. There also seems to be no conflict between the two options -- setting them both also removed the echo entirely.

@kspark-scott
Copy link

kspark-scott commented Jan 7, 2020

@djee-ms, I could make an attempt at the audio option configuration if you like. My thinking is to just copy the existing pattern used by the VideoDeviceConfiguration struct, adding an AudioDeviceConfiguration with a set of mrsBool members that reflect at least some of the cricket::AudioOption members and adding it as a required parameter for mrsPeerConnectionAddLocalAudioTrack(). If you think you might accept a PR like that, would you like to see all audio options exposed, or just the echo cancellation ones with others to be added on demand?

@djee-ms
Copy link
Member

djee-ms commented Jan 8, 2020

@kspark-scott thanks for the offer, but #152 is coming really soon (matter of days) and will already have added an AudioDeviceConfiguration (see here), so your PR would conflict anyway. So I'm thinking instead to add those settings to it just after, should be fairly straightforward.

@sananbintahir
Copy link

sananbintahir commented Sep 3, 2020

I'm also having trouble with acoustic echo cancellation on Unity (PC and Android). Since #152 is now in, is there a way to enable echo cancellation?

@djee-ms could you shed some light on this maybe?

@fibann
Copy link
Member

fibann commented Sep 4, 2020

@sananbintahir #152 has added a per-track audio configuration, but settings for AEC haven't been exposed there yet.

@sananbintahir
Copy link

@fibann Is this on the roadmap? and is there a workaround for now? Not having AEC makes the library pretty much unusable for my application, which targets the Oculus Quest.

@fibann
Copy link
Member

fibann commented Sep 4, 2020

@sananbintahir sorry, no ETA for this at the moment.

You can work around this by compiling MR-WebRTC from source and passing the AEC options mentioned in the comments above to the audio source creation, the relevant lines are now at

@sananbintahir
Copy link

@fibann I tried the workaround and built the library from source, I tried passing

options.echo_cancellation = true;
options.extended_filter_aec = true;
options.delay_agnostic_aec = true;
options.highpass_filter = true;
options.noise_suppression = true;

But all combinations of these options produced little to no effect on the echo. I suppose this is because I am working on Unity, which adds a delay between the signals, causing AEC to not function as it should. Is this possible or am I missing something?

I was also looking into a custom AEC implementation, but that would require access to the incoming audio stream and access to the microphone signal. Is it possible to get access to these in the library?

@KarthikRichie
Copy link

KarthikRichie commented Jan 13, 2021

@sananbintahir Where you able to get a workaround for your problem? I'm facing the same problem as yours and tried setting all the solutions given in this thread. But, it's not resolved yet. If you've found a workaround, could you please share ?

@sananbintahir
Copy link

@KarthikRichie I tried a lot of things, but unfortunately could not find a workaround. Eventually had to give up trying to use MixedReality-WebRTC for my application. Not sure why something as essential as echo cancellation in a communication library is not prioritized.

@KarthikRichie
Copy link

@sananbintahir Okay. I as well tried every possible solution, but nothing seemed to work. Any other webrtc alternatives would you recommend/have tried for use within UWP app which overcomes these limitations ?

@sananbintahir
Copy link

@KarthikRichie Since my application mainly works on Unity, so far I haven't come across any good cross-platform solutions. There is always something you have to sacrifice. For communication just inside unity, there are many alternatives, but none of them have browser support. So it's a tricky situation. This library seemed the most promising until the echo cancellation issue came up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants