Class EchoCancellingAudioSource

ru.yandex.speechkit

java.lang.Object ⇽ EchoCancellingAudioSource

public  class  EchoCancellingAudioSource 

Implementation of the AudioSource interface that applies the "acoustic echo cancellation" (AEC) algorithm to the incoming audio.

To use this algorithm, set the far-end buffer: data that will be subtracted from the audio received through the audio source. This implementation can be used in any class that works with this interface. This class does not record an audio, it only applies additional processing to it. Hence, it should only be used together with another audio source.

Constructors

EchoCancellingAudioSource(@NonNull final AudioSource audioSource)

Creates an object of the EchoCancellingAudioSource class.

Methods

voidappendCancellationBuffer(@NonNull final SoundInfo info, @NonNull final java.nio.ByteBuffer buffer)

Sets the far-end buffer for AEC.

voidfinishEchoCancelling()

Called to stop the AEC algorithm.

Constructor Detail

EchoCancellingAudioSource

public EchoCancellingAudioSource (@NonNull final AudioSource audioSource)

Creates an object of the EchoCancellingAudioSource class.

Parameters:
audioSource

Audio source.

Method Detail

appendCancellationBuffer

public void appendCancellationBuffer (@NonNull final SoundInfo info, @NonNull final java.nio.ByteBuffer buffer)

Sets the far-end buffer for AEC.

Explicit setup of the far-end buffer is required if some audio needs to be removed from the recognition result.
Parameters:
info

Information on the audio.

buffer

Far-end buffer that will be used in the AEC algorithm.

Throws:

Exception

An exception is thrown if the data buffer was created without using the allocateDirect(int) method of the ByteBuffer system class.

finishEchoCancelling

public void finishEchoCancelling ()

Called to stop the AEC algorithm.

If this method is not called, the algorithm will be applied even if the far-end buffer is empty. This may affect the audio processing time.