Skip to main content
Version: 2.x

UOdinPipeline

A highly dynamic audio processing chain that manages a thread-safe collection of filters like voice activity detection, echo cancellation, noise suppression and even custom effects. This allows sequential processing and real-time modification of audio streams through operations like insertion, removal, reordering and configuration updates.

Declaration
UCLASS(ClassGroup = Odin, BlueprintType)
class ODIN_API UOdinPipeline : public UObject
  • Header: #include "OdinAudio/OdinPipeline.h"
  • Module: Odin
  • Inherits from: UObject
  • Blueprint: Blueprint type · Blueprint reference

Overview​

Functions​

NameDescription
ConstructPipeline
GetEffectCountRetrieves the total number of effects currently in the audio pipeline.
GetEffectIdReturns the unique effect identifier from an audio pipeline corresponding to the effect located at the specified index.
GetEffectIndexSearches the specified audio pipeline for the effect with the specified effect_id and returns its current index.
GetEffectTypeObtains the effect type (VAD, APM, or Custom) for the effect identified by effect_id.
MoveEffectReorders the audio pipeline by moving the effect with the specified EffectId to a new index.
RemoveEffectDeletes the effect identified by effect_id from the specified audio pipeline.
RemoveEffectWithCleanupRemoves the effect via the native API and performs the same cache and listener cleanup as RemoveEffect, but returns the raw error code.
InsertCustomEffectInserts a user-defined custom effect at the specified index in the audio pipeline.
InsertCustomEffectNativeSame as InsertCustomEffect (registers the effect's FFI trampoline and parent wiring), but returns the raw error code.
InsertVadEffectInserts a Voice Activity Detection (VAD) effect into the audio pipeline at the specified index and returns a unique effect identifier.
GetVadConfigRetrieves the configuration for a VAD effect identified by effect_id from the specified audio pipeline.
SetVadConfigUpdates the configuration settings of the VAD effect identified by effect_id in the specified audio pipeline.
InsertViEffectInserts a Voice Isolation (VI) effect into the audio pipeline at the specified index and returns a unique effect identifier.
GetViConfigRetrieves the configuration for a VI effect identified by effect_id from the specified audio pipeline.
SetViConfigUpdates the configuration settings of the VI effect identified by effect_id in the specified audio pipeline.
InsertApmEffectInserts an APM effect into the pipeline at the specified index.
GetApmPlaybackFormatRetrieves the playback format that was declared when the APM effect was inserted via InsertApmEffect.
RegisterApmPlaybackFormatRecords the playback format an APM effect was inserted with, so the submix listener can convert the reverse stream accordingly.
SetApmConfigUpdates the configuration settings of the APM effect identified by effect_id in the specified audio pipeline.
SetApmConfigNativeSame as SetApmConfig (including the OnApmConfigChanged broadcast that arms the submix listener), but returns the raw error code.
GetApmConfigRetrieves the configuration for an APM effect identified by effect_id from the specified audio pipeline.
UpdateApmPlaybackUpdates the specified APM effect's sample buffer for processing the reverse (playback) audio stream.
CreateActivityEffectPRESET: Codec-Effect for the odin audio pipeline.
AppendActivityEffectCreates a Activity Effect and adds it at the end of the pipeline.
CreateCloneEffectPRESET: Codec-Effect for the odin audio pipeline.
AppendCloneEffectCreates a Clone Effect and adds it at the end of the pipeline.
CreateMuteEffectPRESET: Codec-Effect for the odin audio pipeline.
AppendMuteEffectCreates a Mute Effect and adds it at the end of the pipeline.
CreateVolumeEffectPRESET: creates a UOdinVolumeEffect, which scales the samples by SampleScale (linear, raised to ScaleExponent, or in decibels if VolumeLog10 is set), and inserts it at the given index.
AppendVolumeEffectCreates a Volume Effect and adds it at the end of the pipeline.
CreateRmsEffectPRESET: Codec-Effect for the odin audio pipeline.
AppendRmsEffectCreates a RMS Effect and adds it at the end of the pipeline.
GetHandle
SetHandle
InvalidateHandleCalled by the owning encoder or decoder before it frees the native pipeline along with its handle.

Functions​

ConstructPipeline​

Static

static UOdinPipeline* ConstructPipeline(UObject* WorldContextObject, const OdinPipeline* Handle);
ParameterTypeDescription
WorldContextObjectUObject*
Handleconst OdinPipeline*

Returns UOdinPipeline*

GetEffectCount​

Const · Blueprint: Get Effect Count

Retrieves the total number of effects currently in the audio pipeline.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
int32 GetEffectCount() const;

Returns int32 – effect count

GetEffectId​

Const · Blueprint: Get Effect Id

Returns the unique effect identifier from an audio pipeline corresponding to the effect located at the specified index.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
int32 GetEffectId(int32 Index) const;
ParameterTypeDescription
Indexint32index of effect

Returns int32 – effect id

GetEffectIndex​

Const · Blueprint: Get Effect Index

Searches the specified audio pipeline for the effect with the specified effect_id and returns its current index.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
int32 GetEffectIndex(int32 EffectId) const;
ParameterTypeDescription
EffectIdint32id of effect

Returns int32 – effect index

GetEffectType​

Const · Blueprint: Get Effect Type

Obtains the effect type (VAD, APM, or Custom) for the effect identified by effect_id.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
EOdinEffectType GetEffectType(int32 EffectId) const;
ParameterTypeDescription
EffectIdint32id of effect

Returns EOdinEffectType – effect type

MoveEffect​

Blueprint: Move Effect

Reorders the audio pipeline by moving the effect with the specified EffectId to a new index.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
bool MoveEffect(int32 EffectId, int32 Index);
ParameterTypeDescription
EffectIdint32Effect for which the index should be changed
Indexint32new index

Returns bool – true on success

RemoveEffect​

Blueprint: Remove Effect

Deletes the effect identified by effect_id from the specified audio pipeline.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
bool RemoveEffect(int32 EffectId);
ParameterTypeDescription
EffectIdint32id of effect

Returns bool – true on success

RemoveEffectWithCleanup​

Removes the effect via the native API and performs the same cache and listener cleanup as RemoveEffect, but returns the raw error code. Every path that removes effects from this pipeline must go through one of the two, otherwise the submix listener keeps feeding the removed effect.

OdinError RemoveEffectWithCleanup(int32 EffectId);
ParameterTypeDescription
EffectIdint32id of effect

Returns OdinError – the native result code

InsertCustomEffect​

Blueprint: Insert Custom Effect

Inserts a user-defined custom effect at the specified index in the audio pipeline. The effect is implemented via a callback function and associated user data. A unique effect identifier is returned.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
int32 InsertCustomEffect(int32 Index, UOdinCustomEffect* Effect);
ParameterTypeDescription
Indexint32desired index
EffectUOdinCustomEffect*effect object

Returns int32 – the new effect id or 0

note

Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.

InsertCustomEffectNative​

Same as InsertCustomEffect (registers the effect's FFI trampoline and parent wiring), but returns the raw error code. Used by the native async Blueprint path.

OdinError InsertCustomEffectNative(int32 Index, UOdinCustomEffect* Effect, uint32& OutEffectId);
ParameterTypeDescription
Indexint32
EffectUOdinCustomEffect*
OutEffectIduint32&

Returns OdinError

InsertVadEffect​

Blueprint: Insert VAD Effect

Inserts a Voice Activity Detection (VAD) effect into the audio pipeline at the specified index and returns a unique effect identifier.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
int32 InsertVadEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns int32 – the new effect id or 0

note

Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.

GetVadConfig​

Const · Blueprint: Get VAD Config

Retrieves the configuration for a VAD effect identified by effect_id from the specified audio pipeline.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
FOdinVadConfig GetVadConfig(int32 EffectId) const;
ParameterTypeDescription
EffectIdint32effect id

Returns FOdinVadConfig – VAD config

note

Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.

If the effect was disabled the resulting config object is filled with default values/empty

SetVadConfig​

Blueprint: Set VAD Config

Updates the configuration settings of the VAD effect identified by effect_id in the specified audio pipeline.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
bool SetVadConfig(int32 EffectId, FOdinVadConfig Config);
ParameterTypeDescription
EffectIdint32effect id
ConfigFOdinVadConfigthe config to set

Returns bool – true on success

InsertViEffect​

Blueprint: Insert VI Effect

Inserts a Voice Isolation (VI) effect into the audio pipeline at the specified index and returns a unique effect identifier. The effect starts out disabled and needs an explicit configuration to start filtering.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
int32 InsertViEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns int32 – the new effect id or 0

note

Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.

The first instance loads the underlying inference model, which can take several hundred milliseconds; additional instances share the already loaded model.

GetViConfig​

Const · Blueprint: Get VI Config

Retrieves the configuration for a VI effect identified by effect_id from the specified audio pipeline.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
FOdinViConfig GetViConfig(int32 EffectId) const;
ParameterTypeDescription
EffectIdint32effect id

Returns FOdinViConfig – VI config

note

If the effect was disabled the resulting config object is filled with default values/empty

SetViConfig​

Blueprint: Set VI Config

Updates the configuration settings of the VI effect identified by effect_id in the specified audio pipeline. Re-enabling a disabled effect also resets its internal state.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
bool SetViConfig(int32 EffectId, FOdinViConfig Config);
ParameterTypeDescription
EffectIdint32effect id
ConfigFOdinViConfigthe config to set

Returns bool – true on success

InsertApmEffect​

Blueprint: Insert APM Effect

Inserts an APM effect into the pipeline at the specified index.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
int32 InsertApmEffect(int32 Index, int32 SampleRate = 0, bool bStereo = true);
ParameterTypeDescription
Indexint32The position at which the APM effect should be inserted in the pipeline.
SampleRateint32The playback sample rate for the APM effect. 0 uses the current audio mixer sample rate. Default: 0.
bStereoboolA boolean indicating whether the APM effect should use stereo (true) or mono (false) mode. Default: true.

Returns int32 – The unique identifier of the inserted APM effect if the operation is successful, or -1 if an error occurs.

note

Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.

The playback format describes the samples fed into the echo-cancellation reverse stream. In this plugin that source is the UE main submix, so the defaults (0 = current audio mixer sample rate, stereo) are the right choice unless the reverse stream is fed manually with a different format.

GetApmPlaybackFormat​

Const

Retrieves the playback format that was declared when the APM effect was inserted via InsertApmEffect.

bool GetApmPlaybackFormat(int32 EffectId, int32& OutSampleRate, bool& bOutStereo) const;
ParameterTypeDescription
EffectIdint32effect id
OutSampleRateint32&the playback sample rate the effect was inserted with
bOutStereobool&whether the effect was inserted with a stereo playback stream

Returns bool – true if the effect id is known to this pipeline

RegisterApmPlaybackFormat​

Records the playback format an APM effect was inserted with, so the submix listener can convert the reverse stream accordingly. Called by InsertApmEffect; must also be called by any path that inserts an APM effect into this pipeline directly via the native API.

void RegisterApmPlaybackFormat(int32 EffectId, int32 SampleRate, bool bStereo);
ParameterTypeDescription
EffectIdint32effect id returned by the native insert call
SampleRateint32the declared playback sample rate
bStereoboolwhether the declared playback stream is stereo

SetApmConfig​

Blueprint: Set APM Config

Updates the configuration settings of the APM effect identified by effect_id in the specified audio pipeline.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
bool SetApmConfig(int32 EffectId, FOdinApmConfig Config);
ParameterTypeDescription
EffectIdint32effect id
ConfigFOdinApmConfigthe config to set

Returns bool – true on success

SetApmConfigNative​

Same as SetApmConfig (including the OnApmConfigChanged broadcast that arms the submix listener), but returns the raw error code. Used by the native async Blueprint path.

OdinError SetApmConfigNative(int32 EffectId, FOdinApmConfig Config);
ParameterTypeDescription
EffectIdint32
ConfigFOdinApmConfig

Returns OdinError

GetApmConfig​

Const · Blueprint: Get APM Config

Retrieves the configuration for an APM effect identified by effect_id from the specified audio pipeline.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Pipeline")
FOdinApmConfig GetApmConfig(int32 EffectId) const;
ParameterTypeDescription
EffectIdint32effect id

Returns FOdinApmConfig – APM config

note

if the effect was disabled the resulting config object is filled with default values/empty

UpdateApmPlayback​

Overload 1

Blueprint: Update APM Playback

Updates the specified APM effect's sample buffer for processing the reverse (playback) audio stream. The provided samples must be interleaved float values in the range [-1, 1]. The delay parameter is used to align the reverse stream processing with the forward (capture) stream.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline")
bool UpdateApmPlayback(int32 EffectId, TArray<float>& Samples, int32 Delay = 10);
ParameterTypeDescription
EffectIdint32effect id
SamplesTArray<float>&audio buffer
Delayint32delay in milliseconds (ms) Default: 10.

Returns bool – true on success

note

The delay can be expressed as:

delay = (t_render - t_analyze) + (t_process - t_capture)

where:

  • t_render is the time the first sample of the same frame is rendered by the audio hardware.

  • t_analyze is the time the frame is processed in the reverse stream.

  • t_capture is the time the first sample of a frame is captured by the audio hardware.

  • t_process is the time the frame is processed in the forward stream.

Overload 2

Updates the specified APM effect's sample buffer for processing the reverse (playback) audio stream. The provided samples must be interleaved float values in the range [-1, 1]. The delay parameter is used to align the reverse stream processing with the forward (capture) stream. The delay can be expressed as:

delay = (t_render - t_analyze) + (t_process - t_capture)

where: - t_render is the time the first sample of the same frame is rendered by the audio hardware. - t_analyze is the time the frame is processed in the reverse stream. - t_capture is the time the first sample of a frame is captured by the audio hardware. - t_process is the time the frame is processed in the forward stream.

bool UpdateApmPlayback(int32 EffectId, const float* Samples, int32 Count, int32 Delay = 10);
ParameterTypeDescription
EffectIdint32
Samplesconst float*
Countint32
Delayint32Default: 10.

Returns bool

CreateActivityEffect​

Blueprint: Create Activity Effect

PRESET: Codec-Effect for the odin audio pipeline. The effect will invoke activity event and field based on the silent flag. Event is dispatched to the GameThread.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinActivityEffect* CreateActivityEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns UOdinActivityEffect* – the custom effect object

AppendActivityEffect​

Blueprint: Append Activity Effect

Creates a Activity Effect and adds it at the end of the pipeline. The effect raises Activity Callback whenever the audio switches between silent and active, e.g. to drive a "speaking" indicator.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinActivityEffect* AppendActivityEffect();

Returns UOdinActivityEffect* – The created Activity Effect. Keep it to change its properties at runtime.

CreateCloneEffect​

Blueprint: Create Clone Effect

PRESET: Codec-Effect for the odin audio pipeline. The effect will invoke Callback function with a copy of samples buffer and if bound to the delegate, a clone of that buffer. Callback will be called on the GameThread by default.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinCloneEffect* CreateCloneEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns UOdinCloneEffect* – the custom effect object

AppendCloneEffect​

Blueprint: Append Clone Effect

Creates a Clone Effect and adds it at the end of the pipeline. The effect copies the audio that passes through the pipeline and hands it to On Dispatch Clone Callback on the game thread, e.g. for recording or analysis.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinCloneEffect* AppendCloneEffect();

Returns UOdinCloneEffect* – The created Clone Effect. Keep it to change its properties at runtime.

CreateMuteEffect​

Blueprint: Create Mute Effect

PRESET: Codec-Effect for the odin audio pipeline. The effect will mutate the silent flag based on the mute uproperty. Sets the flag for following chaining effects in the pipeline as well. Symbolizing silenced audio data without changing the buffer. This results in not necessarily sending the audio packet over the network at all.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinMuteEffect* CreateMuteEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns UOdinMuteEffect* – the custom effect object

AppendMuteEffect​

Blueprint: Append Mute Effect

Creates a Mute Effect and adds it at the end of the pipeline. Set its Mute Flag to Set to mark the audio as silent, so nothing is transmitted, and to Unset or None to let it pass. Effects after it in the pipeline see the silent flag as well. See the Push To Talk guide.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinMuteEffect* AppendMuteEffect();

Returns UOdinMuteEffect* – The created Mute Effect. Keep it to change its properties at runtime.

CreateVolumeEffect​

Blueprint: Create Volume Effect

PRESET: creates a UOdinVolumeEffect, which scales the samples by SampleScale (linear, raised to ScaleExponent, or in decibels if VolumeLog10 is set), and inserts it at the given index.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinVolumeEffect* CreateVolumeEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns UOdinVolumeEffect* – the custom effect object

AppendVolumeEffect​

Blueprint: Append Volume Effect

Creates a Volume Effect and adds it at the end of the pipeline. The effect multiplies the samples by Sample Scale (raised to Scale Exponent), or treats Sample Scale as a gain in decibels when Volume Log10 is set.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinVolumeEffect* AppendVolumeEffect();

Returns UOdinVolumeEffect* – The created Volume Effect. Keep it to change its properties at runtime.

CreateRmsEffect​

Blueprint: Create Rms Effect

PRESET: Codec-Effect for the odin audio pipeline. The effect will set RMS-dBFS based on samples.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinRmsEffect* CreateRmsEffect(int32 Index);
ParameterTypeDescription
Indexint32desired index

Returns UOdinRmsEffect* – the custom effect object

AppendRmsEffect​

Blueprint: Append Rms Effect

Creates a RMS Effect and adds it at the end of the pipeline. The effect measures the loudness of the audio as RMS in dBFS and stores it in Rms Dbfs.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Pipeline|Effects")
UOdinRmsEffect* AppendRmsEffect();

Returns UOdinRmsEffect* – The created RMS Effect. Keep it to change its properties at runtime.

GetHandle​

Const · Inline

const OdinPipeline* GetHandle() const;

Returns const OdinPipeline*

SetHandle​

void SetHandle(const OdinPipeline* NewHandle);
ParameterTypeDescription
NewHandleconst OdinPipeline*

InvalidateHandle​

Called by the owning encoder or decoder before it frees the native pipeline along with its handle.

void InvalidateHandle();

Events​

OnApmConfigChanged​

Blueprint: On Apm Config Changed

Raised when the configuration of an APM effect in this pipeline changes through Set APM Config.

UPROPERTY(BlueprintAssignable, Category = "Odin|Audio Pipeline")
FApmConfigChangedDelegate OnApmConfigChanged;

Signature: FApmConfigChangedDelegate void(UOdinPipeline* Pipeline, int32 EffectId, FOdinApmConfig NewApmConfig) (multicast)