au.itd.SetInterpolationTime
au.itd.SetInterpolationTime
#Overview
name: au.itd.SetInterpolationTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets how quickly the audio renderer follows the objects position, in seconds.\nValue: Interpolation time, in seconds.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.itd.SetInterpolationTime is to control the interpolation time for the Interaural Time Difference (ITD) spatialization in Unreal Engine’s audio system. It sets how quickly the audio renderer follows the object’s position in 3D space.
This setting variable is primarily used in the Spatialization plugin, which is part of Unreal Engine’s audio rendering system. Specifically, it’s utilized in the ITDSpatializer module, which handles spatial audio processing based on interaural time differences.
The value of this variable is set through the Unreal Engine console variable system. It’s defined using FAutoConsoleVariableRef, which allows it to be adjusted at runtime through console commands or configuration files.
The au.itd.SetInterpolationTime variable interacts directly with the InterpolationTauCVar variable. They share the same value, with InterpolationTauCVar being the actual float variable used in the code, while au.itd.SetInterpolationTime is the console-accessible name for adjusting this value.
Developers should be aware that this variable affects the responsiveness of spatial audio. A lower value will make the audio position changes more immediate, while a higher value will create smoother transitions but with more latency in position updates.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your game or application.
- Testing different values to find the right balance between responsiveness and smoothness.
- Considering performance implications, as very low values might increase CPU usage.
Regarding the associated variable InterpolationTauCVar:
The purpose of InterpolationTauCVar is to store the actual float value used in the audio spatialization calculations. It represents the interpolation time in seconds.
This variable is used directly in the FSourceSpatializer constructor to calculate the ease factor for audio interpolation. It’s multiplied by the sample rate to determine how quickly audio position changes are applied.
The value of InterpolationTauCVar is set initially to 0.1 seconds, but can be modified through the au.itd.SetInterpolationTime console variable.
InterpolationTauCVar interacts with the audio sample rate and is used in exponential easing calculations for smooth audio transitions.
Developers should be aware that changes to this variable will directly affect the behavior of the spatial audio system. It’s a critical component in determining how responsive and smooth spatial audio transitions are.
Best practices for InterpolationTauCVar include:
- Keeping it in sync with au.itd.SetInterpolationTime.
- Considering its impact on both audio quality and performance when adjusting.
- Testing thoroughly with different values in various audio scenarios to ensure optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/Spatialization/Source/Spatialization/Private/ITDSpatializer.cpp:27
Scope: file
Source code excerpt:
static float InterpolationTauCVar = 0.1f;
FAutoConsoleVariableRef CVarInterpolationTime(
TEXT("au.itd.SetInterpolationTime"),
InterpolationTauCVar,
TEXT("Sets how quickly the audio renderer follows the objects position, in seconds.\n")
TEXT("Value: Interpolation time, in seconds."),
ECVF_Default);
static int32 EnableILDCVar = 1;
#Associated Variable and Callsites
This variable is associated with another variable named InterpolationTauCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/Spatialization/Source/Spatialization/Private/ITDSpatializer.cpp:25
Scope: file
Source code excerpt:
ECVF_Default);
static float InterpolationTauCVar = 0.1f;
FAutoConsoleVariableRef CVarInterpolationTime(
TEXT("au.itd.SetInterpolationTime"),
InterpolationTauCVar,
TEXT("Sets how quickly the audio renderer follows the objects position, in seconds.\n")
TEXT("Value: Interpolation time, in seconds."),
ECVF_Default);
static int32 EnableILDCVar = 1;
FAutoConsoleVariableRef CVarEnablePanning(
#Loc: <Workspace>/Engine/Plugins/Runtime/Spatialization/Source/Spatialization/Private/ITDSpatializer.cpp:50
Scope (from outer to inner):
file
function FSourceSpatializer::FSourceSpatializer
Source code excerpt:
// Max delay line length will be the maximum distance audio will need to travel divided by the speed of sound:
const float MaxDelay = 0.5f; //HeadWidthCVar / 1000.0f / SpeedOfSoundCVar;
const float EaseFactor = Audio::FExponentialEase::GetFactorForTau(InterpolationTauCVar, InSampleRate);
LeftDelays.Reset();
LeftDelays.AddDefaulted(2);
RightDelays.Reset();
RightDelays.AddDefaulted(2);