本文にスキップする
Version: 6.2

アプリケーションのAECリファレンス

アプリケーションAEC(acoustic echo canceller、エコー除去フィルター)リファレンス機能を使用すると、エコー除去に使用するカスタムリファレンスデータを提供できます。

オーディオをスピーカーに出力する前にサウンド効果をミックスするなど、編集が必要な場合があります。AECでデフォルトで使用されるリファレンスデータは元のオーディオに基づいて作成されているため、ミックスしたサウンド効果によってエコーが発生する可能性があります。このようにオーディオを変調した場合は、アプリケーションAECリファレンス機能を使用して正確なリファレンスデータを提供することで、エコーをより完全に除去できます。

Tip

AECの詳細については、エコー除去フィルターを参照してください。

通話タイプSDKの最低バージョン
1対1通話、グループ通話(カンファレンス)PlanetKit 3.8

活用事例

以下のようなアプリケーション要件がある場合、アプリケーションAECリファレンス機能を活用できます。

  • PlanetKit SDKとは無関係にアプリケーションで音源を再生するなどの動作がある場合

実装手順

アプリケーションAECリファレンス機能を実装する手順は、次のとおりです。

アプリケーションAECリファレンスの使用を開始する

アプリケーションAECリファレンスの使用を開始するには、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")
}
}

アプリケーションAECリファレンスを提供する

アプリケーションAECリファレンスを提供するには、リファレンスオーディオデータを引数としてputUserAcousticEchoCancellerReference()を呼び出します。

Note

詳細な実装コードの例は、カスタムオーディオシンククラスを実装するを参照してください。

// 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)

アプリケーションAECリファレンスの使用を中止する

アプリケーションAECリファレンスの使用を中止するには、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")
}
}

インターフェースの変更

下表は、アプリケーションAECリファレンスに関連するAPIの変更を示しています。

PlanetKitバージョン提供するメソッド備考
5.2以上startUserAcousticEchoCancellerReference()
putUserAcousticEchoCancellerReference()
stopUserAcousticEchoCancellerReference()
APIの名称が変更されました。
3.8から5.1までstartAECReferenceData()
putAECReferenceData()
stopAECReferenceData()
useAECReferenceが削除されました。
3.7putAECReferenceData()アプリケーションAECリファレンスを使用するには、1対1通話パラメーターまたはグループ通話パラメーターでuseAECReferencetrueに設定してください。

関連API

アプリケーションAECリファレンスに関連するAPIは次のとおりです。

1対1通話

グループ通話