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.
For more information on how AEC works, refer to Acoustic echo canceller.
| Supported call type | Minimum 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 outputting audio captured by an actual microphone device after modifying it (such as mixing sound effects) in a custom audio sink
NoteFor more information, refer to When application AEC reference settings are required.
- 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
PlanetKit::PlanetKitCallPtr m_pCall;
... // Obtain the PlanetKitCall instance from the result of MakeCall() or VerifyCall()
m_pCall->StartUserAcousticEchoCancellerReference(nullptr, [](void* pUserData, bool bSuccess) {
if (bSuccess) {
std::wcout << L"Application AEC reference started successfully" << std::endl;
}
});
// Group call
PlanetKit::PlanetKitConferencePtr m_pConference;
... // Obtain the PlanetKitConference instance from the result of JoinConference()
m_pConference->StartUserAcousticEchoCancellerReference(nullptr, [](void* pUserData, bool bSuccess) {
if (bSuccess) {
std::wcout << L"Application AEC reference started successfully" << std::endl;
}
});
Provide application AEC reference
To provide application AEC reference, call PutUserAcousticEchoCancellerReference() with the reference audio data as an argument.
For a detailed implementation code example, refer to Implement a custom audio sink class.
// Create a modified audio data
PlanetKit::SAudioData modifiedAudioData;
// 1-to-1 call
m_pCall->PutUserAcousticEchoCancellerReference(modifiedAudioData);
// Group call
m_pConference->PutUserAcousticEchoCancellerReference(modifiedAudioData);
Stop application AEC reference
To stop using the application AEC reference, call StopUserAcousticEchoCancellerReference().
// 1-to-1 call
m_pCall->StopUserAcousticEchoCancellerReference(nullptr, [](void* pUserData, bool bSuccess) {
if (bSuccess) {
std::wcout << L"Application AEC reference stopped successfully" << std::endl;
}
});
// Group call
m_pConference->StopUserAcousticEchoCancellerReference(nullptr, [](void* pUserData, bool bSuccess) {
if (bSuccess) {
std::wcout << L"Application AEC reference stopped successfully" << std::endl;
}
});
Interface changes
The following table shows changes on the APIs related to application AEC reference.
| PlanetKit version | Supported Methods | Note |
|---|---|---|
| 5.2 or higher | StartUserAcousticEchoCancellerReference()PutUserAcousticEchoCancellerReference()StopUserAcousticEchoCancellerReference() | API naming has been changed. |
| 3.8 through 5.1 | StartAECReferenceData()PutAECReferenceData()StopAECReferenceData() | useAECReference has been removed. |
| 3.7 | PutAECReferenceData() | Set useAECReference in a call parameter or conference parameter to true to use the application AEC reference. |
Related API
APIs related to the application AEC reference are as follows.
1-to-1 call
-
PlanetKitCall::StartUserAcousticEchoCancellerReference() -
PlanetKitCall::PutUserAcousticEchoCancellerReference() -
PlanetKitCall::StopUserAcousticEchoCancellerReference()