Class YSKEchoCancellingAudioSource

The YSKAudioSource protocol implementation that applies the "acoustic echo cancellation" (AEC) algorithm to the incoming audio.

To use this algorithm, set the far-end buffer: data to be subtracted from the audio received from the audio source. This implementation can be used in any class that uses the YSKAudioSource protocol. 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.

Instance Methods

-appendCancellationBuffer:

Sets the far-end buffer for AEC.

-finishEchoCancelling

Stops the AEC algorithm.

-initWithAudioSource:outputLatency:

Initializes an object of the YSKEchoCancellingAudioSource class.

Properties

outputLatency

The delay between the start of audio playback and its actual hit on the device speaker.

Method Detail

-appendCancellationBuffer:

- (void)appendCancellationBuffer:(YSKSoundBuffer *)soundBuffer 

Sets the far-end buffer for AEC.

The far-end buffer needs to be set to remove some audio from the recognition result.
Parameters:
soundBuffer

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

-finishEchoCancelling

- (void)finishEchoCancelling

Stops 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.

-initWithAudioSource:outputLatency:

- (instancetype)initWithAudioSource:(id< YSKAudioSource >)audioSource
                      outputLatency:(NSTimeInterval)outputLatency 

Initializes an object of the YSKEchoCancellingAudioSource class.

The object of the YSKEchoCancellingAudioSource class does not record an audio from the speaker of a device, file, or any other source, it only applies the AEC algorithm to the incoming audio. So to enable it, specify the audio source that will record an audio and transmit it to the object of the YSKEchoCancellingAudioSource class. The outputLatency parameter can be obtained from the -[AVAudioSession outputLatency] system class property or set independently.
Parameters:
audioSource

The audio source from which an audio is received for processing.

outputLatency

The delay between the start of audio playback and its actual hit on the device speaker.

Returns:

An object of the YSKEchoCancellingAudioSource class.

Property Detail

outputLatency

(assign, readwrite) NSTimeInterval outputLatency

The delay between the start of audio playback and its actual hit on the device speaker.

This value depends on the device and strongly affects the AEC quality. In iOS, this value can be obtained from the -[AVAudioSession outputLatency] system class property or set independently.