GlobalMinPitchScale
GlobalMinPitchScale
#Overview
name: GlobalMinPitchScale
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of GlobalMinPitchScale is to define the minimum pitch scale value for audio in the Unreal Engine 5. This setting is part of the audio system and is used to clamp the lower bound of pitch scaling for sound playback.
GlobalMinPitchScale is primarily used by the Engine’s audio subsystem, specifically within the FAudioDevice class. It’s defined in the UAudioSettings class, which is part of the Engine’s core audio module.
The value of this variable is set in two places:
- It’s initialized in the UAudioSettings constructor with a default value of 0.4F.
- It can be configured through the project settings, as indicated by the UPROPERTY macro with the ‘config’ specifier.
GlobalMinPitchScale interacts with GlobalMaxPitchScale, which defines the upper bound of pitch scaling. Together, these variables set the range for pitch modification in the engine’s audio system.
Developers should be aware of the following when using this variable:
- The value is clamped to a minimum of 0.001, as specified in the UPROPERTY meta data.
- The UI for this setting in the editor is configured to have a range of 0.001 to 4.0.
- When the FAudioDevice is initialized, it uses FMath::Max to ensure the value is at least 0.0001f, providing an additional safety check.
Best practices for using this variable include:
- Carefully consider the impact on audio quality and performance when adjusting this value.
- Ensure that GlobalMinPitchScale is always less than or equal to GlobalMaxPitchScale to maintain a valid pitch range.
- Test audio thoroughly after making changes to this setting, as it can affect all pitched sounds in the game.
- Use the project settings interface to modify this value rather than hard-coding changes, to maintain configurability.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:257, section: [/Script/Engine.AudioSettings]
- INI Section:
/Script/Engine.AudioSettings
- Raw value:
0.250000
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/AudioSettings.h:190
Scope (from outer to inner):
file
class class UAudioSettings : public UDeveloperSettings
Source code excerpt:
/** The value to use to clamp the min pitch scale */
UPROPERTY(config, EditAnywhere, Category = "Audio", meta = (ClampMin = 0.001, UIMin = 0.001, UIMax = 4.0))
float GlobalMinPitchScale;
/** The value to use to clamp the max pitch scale */
UPROPERTY(config, EditAnywhere, Category = "Audio", meta = (ClampMin = 0.001, UIMin = 0.001, UIMax = 4.0))
float GlobalMaxPitchScale;
UPROPERTY(config, EditAnywhere, Category="Quality")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:521
Scope (from outer to inner):
file
function bool FAudioDevice::Init
Source code excerpt:
const UAudioSettings* AudioSettings = GetDefault<UAudioSettings>();
GlobalMinPitch = FMath::Max(AudioSettings->GlobalMinPitchScale, 0.0001f);
GlobalMaxPitch = FMath::Max(AudioSettings->GlobalMaxPitchScale, 0.0001f);
bAllowCenterChannel3DPanning = AudioSettings->bAllowCenterChannel3DPanning;
bAllowPlayWhenSilent = AudioSettings->bAllowPlayWhenSilent;
DefaultReverbSendLevel = AudioSettings->DefaultReverbSendLevel_DEPRECATED;
const FSoftObjectPath DefaultBaseSoundMixName = GetDefault<UAudioSettings>()->DefaultBaseSoundMix;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioSettings.cpp:25
Scope (from outer to inner):
file
function UAudioSettings::UAudioSettings
Source code excerpt:
bParameterInterfacesRegistered = false;
GlobalMinPitchScale = 0.4F;
GlobalMaxPitchScale = 2.0F;
DefaultAudioCompressionType = EDefaultAudioCompressionType::BinkAudio;
}
void UAudioSettings::AddDefaultSettings()