How to use AEC effect in OpenSLES

1,193 views
Skip to first unread message

Brendon Costa

unread,
Jun 15, 2013, 5:37:14 PM6/15/13
to andro...@googlegroups.com
Hi,

I am using OpenSLES and noticed on my phone when querying the SLAndroidEffectCapabilitiesItf interface, that i have an effect: "Acoustic Echo Canceler" amongst others.

How do I go about using this (I cant find any relevant docs/examples)?

I assumed I needed to add the effect interface to a Audio Recorder object, but that fails.

I want access to the following:
* Is the effect currently enabled? (If so don't do echo cancellation in our own app)
* Ability to turn the effect on/off (On some devices our implementation may be better)

What I am trying now is:
* Query effect implementation interface id from SLAndroidEffectCapabilitiesItf
* Add SL_IID_ANDROIDEFFECT to Audio Recorder object
* Get SLAndroidEffectItf interface
* Call SLAndroidEffectItf::CreateEffect() with the effect_impl interface id obtained from SLAndroidEffectCapabilitiesItf
* Call SLAndroidEffectItf::SetEnabled()

As I said, I expect this effect to be available on the recorder as it modifies what the input audio from the mic sounds like but I cant do that it seems.

Can I somehow even do this in Java land and have it affect my OpenSL recorder?

Also, what is the difference between the Effect and the EffectSend interfaces?


Thanks,
Brendon.

Zoran Angelov

unread,
Nov 22, 2013, 10:22:07 PM11/22/13
to andro...@googlegroups.com
Hi Brendon,
Have you made any progress on this?
I know that topic is little too old, but there is very few info on this topic, and i want to share my experience.
I was trying to do the same, and found that "Acoustic Echo Canceler", "Noice Suppression" and all preprocessing effects can not be used by OpenSLES.
What i've found is that SLAndroidEffectItf is only exposed by AudioPlayer and possibly by OutputMix (but could not achieve that).
OpenSLES is reporting all libmedia (android.media) effects but can use post processing effects only like BassBoost, Equalizer etc.
android.media is running audio on two type of threads input and output. Since SLAndroidEffectItf is exposed by objects that are run on output threads, it is creating the effects in that way (parameters passed to android::AudioEffect).
So it can create postprocessing effects only.
I'm getting error by AudioFlinger and libmedia that AEC kind of effect can not be created on output thread type (i think it was thread type 0).


Thanks,
Zoran


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages