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:

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
let call: PlanetKitCall
... // Obtain the PlanetKitCall instance from the result of makeCall() or verifyCall()

call.startUserAcousticEchoCancellerReference { success in
if success {
print("Application AEC reference started successfully")
}
}

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

conference.startUserAcousticEchoCancellerReference { success in
if success {
print("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.

// Create a audio buffer for audio modification
let audioBuffer = PlanetKitAudioBuffer(...)

... // Modify the audio data

// 1-to-1 call
call?.putUserAcousticEchoCancellerReference(frameCnt: frameCnt,
channels: channels,
sampleRate: sampleRate,
sampleType: .signedFloat32,
outData: audioBuffer.buffer,
outDataLen: audioBuffer.bufferSize)

// Group call
conference?.putUserAcousticEchoCancellerReference(frameCnt: frameCnt,
channels: channels,
sampleRate: sampleRate,
sampleType: .signedFloat32,
outData: audioBuffer.buffer,
outDataLen: audioBuffer.bufferSize)

Stop application AEC reference

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

// 1-to-1 call
call.stopUserAcousticEchoCancellerReference { success in
if success {
print("Application AEC reference stopped successfully")
}
}

// Group call
conference.stopUserAcousticEchoCancellerReference { success in
if success {
print("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