Skip to main content
Version: 6.2

Application AEC reference

The application AEC (acoustic echo canceller) reference feature allows you to provide custom reference data for echo cancellation.

There may be cases where you need to edit audio before outputting it to speakers, such as mixing sound effects. Since the reference data used by AEC is based on the original audio, echo can occur due to mixed sound effects. In cases where audio is modified like this, you can remove echo more completely by providing accurate reference data through the application AEC reference feature.

Tip

For more information on how AEC works, refer to Acoustic echo canceller.

Supported call typeMinimum SDK version
1-to-1 call, group call (conference)PlanetKit 3.8

Use cases

You can use the application AEC reference feature when you have application requirements such as:

  • When the application plays audio independently of PlanetKit SDK

Implementation steps

The procedure for implementing the application AEC reference feature is as follows.

Start application AEC reference

To start using the application AEC reference, call startUserAcousticEchoCancellerReference().

// 1-to-1 call
val call: PlanetKitCall
... // Obtain the PlanetKitCall instance from the result of makeCall() or verifyCall()

call.startUserAcousticEchoCancellerReference { result ->
if (result.isSuccessful) {
Log.d(TAG, "Application AEC reference started successfully")
}
}

// Group call
val conference: PlanetKitConference
... // Obtain the PlanetKitConference instance from the result of joinConference()

conference.startUserAcousticEchoCancellerReference { result ->
if (result.isSuccessful) {
Log.d(TAG, "Application AEC reference started successfully")
}
}

Provide application AEC reference

To provide application AEC reference, call putUserAcousticEchoCancellerReference() with the reference audio data as an argument.

Note

For a detailed implementation code example, refer to Implement a custom audio sink class.

// In the class implementing AudioSink, modify audio data and provide AEC reference
class MyCustomAudioSink(): AudioSink() {
...
private fun writeAudioFrame() {
val frame = getFrameData(...)
...
putUserAcousticEchoCancellerReference(frame)
frame.release()
}
}

Stop application AEC reference

To stop using the application AEC reference, call stopUserAcousticEchoCancellerReference().

// 1-to-1 call
call.stopUserAcousticEchoCancellerReference { result ->
if (result.isSuccessful) {
Log.d(TAG, "Application AEC reference stopped successfully")
}
}

// Group call
conference.stopUserAcousticEchoCancellerReference { result ->
if (result.isSuccessful) {
Log.d(TAG, "Application AEC reference stopped successfully")
}
}

Interface changes

The following table shows changes on the APIs related to application AEC reference.

PlanetKit versionSupported MethodsNote
5.2 or higherstartUserAcousticEchoCancellerReference()
putUserAcousticEchoCancellerReference()
stopUserAcousticEchoCancellerReference()
API naming has been changed.
3.8 through 5.1startAECReferenceData()
putAECReferenceData()
stopAECReferenceData()
useAECReference has been removed.
3.7putAECReferenceData()Set useAECReference in a call parameter or conference parameter to true to use the application AEC reference.

APIs related to the application AEC reference are as follows.

1-to-1 call

Group call