GlobalMaxPitchScale

GlobalMaxPitchScale

#Overview

name: GlobalMaxPitchScale

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 GlobalMaxPitchScale is to set the maximum pitch scale value for audio playback in Unreal Engine 5. This setting variable is part of the audio system and is used to clamp the upper limit of pitch manipulation for sound assets.

The Unreal Engine audio subsystem relies on this setting variable. It’s primarily used in the Engine module, specifically within the AudioDevice and AudioSettings classes.

The value of this variable is set in the UAudioSettings constructor in AudioSettings.cpp, with a default value of 2.0F. It can also be configured through the project settings in the Unreal Editor, as indicated by the UPROPERTY macro with the ‘config’ and ‘EditAnywhere’ specifiers.

GlobalMaxPitchScale interacts with GlobalMinPitchScale, which sets the minimum pitch scale. Together, these two variables define the range of pitch manipulation allowed in the engine.

Developers must be aware that this variable affects all audio in the game. Setting it too high might result in unrealistic or unpleasant sound distortions, while setting it too low could limit the desired audio effects.

Best practices when using this variable include:

  1. Keeping it within a reasonable range (the UI suggests a maximum of 4.0).
  2. Testing thoroughly with various audio assets to ensure the chosen value doesn’t negatively impact the game’s sound quality.
  3. Considering the target platform and performance implications when adjusting this value.
  4. Documenting any changes to this value for the development team, as it can affect the work of sound designers and audio programmers.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:258, section: [/Script/Engine.AudioSettings]

#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:194

Scope (from outer to inner):

file
class        class UAudioSettings : public UDeveloperSettings

Source code excerpt:

	/** 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")
	TArray<FAudioQualitySettings> QualityLevels;

	/** Allows sounds to play at 0 volume. */
	UPROPERTY(config, EditAnywhere, Category = "Audio", AdvancedDisplay)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioDevice.cpp:522

Scope (from outer to inner):

file
function     bool FAudioDevice::Init

Source code excerpt:


	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;
	if (DefaultBaseSoundMixName.IsValid())

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioSettings.cpp:26

Scope (from outer to inner):

file
function     UAudioSettings::UAudioSettings

Source code excerpt:


	GlobalMinPitchScale = 0.4F;
	GlobalMaxPitchScale = 2.0F;

	DefaultAudioCompressionType = EDefaultAudioCompressionType::BinkAudio;
}

void UAudioSettings::AddDefaultSettings()
{