LowSampleRate

LowSampleRate

#Overview

name: LowSampleRate

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 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LowSampleRate is to define the sampling rate for low-quality audio in Unreal Engine 5. It is used in the audio system to set the resampling quality for different platforms during the cooking process.

This setting variable is relied upon by multiple Unreal Engine subsystems and platform-specific modules:

  1. Windows: WindowsTargetPlatform module
  2. Android: AndroidRuntimeSettings module
  3. iOS: IOSRuntimeSettings module
  4. Engine: Audio compression settings

The value of this variable is set in different places depending on the target platform:

  1. For Windows, it’s set in the WindowsTargetSettings constructor with a default value of 12000 Hz.
  2. For Android, it’s set in the AndroidRuntimeSettings constructor with a default value of 12000 Hz.
  3. For iOS, it’s set in the IOSRuntimeSettings constructor with a default value of 12000 Hz.

This variable interacts with other sample rate variables such as HighSampleRate, MedSampleRate, and MinSampleRate. Together, they form a set of options for audio resampling quality.

Developers must be aware that:

  1. This setting affects the audio quality and file size of the game’s audio assets.
  2. Different platforms may have different default values or requirements for audio sample rates.
  3. Changing this value will impact the audio cooking process and the final audio output in the game.

Best practices when using this variable include:

  1. Consider the target platform’s capabilities and requirements when adjusting this value.
  2. Balance audio quality with file size and performance implications.
  3. Test thoroughly after making changes to ensure audio quality meets expectations across all supported platforms.
  4. Coordinate with the audio team to determine the most appropriate sample rates for different quality levels in the game.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:318, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Classes/WindowsTargetSettings.h:129

Scope (from outer to inner):

file
class        class UWindowsTargetSettings : public UObject

Source code excerpt:


	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Low"))
	float LowSampleRate;

	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Min"))
	float MinSampleRate;

	/** Scales all compression qualities when cooking to this platform. For example, 0.5 will halve all compression qualities, and 1.0 will leave them unchanged. */
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides")

#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Private/WindowsTargetPlatformClasses.cpp:11

Scope (from outer to inner):

file
function     UWindowsTargetSettings::UWindowsTargetSettings

Source code excerpt:

	, HighSampleRate(32000)
	, MedSampleRate(24000)
	, LowSampleRate(12000)
	, MinSampleRate(8000)
	, CompressionQualityModifier(1)
{
	// Default windows settings
	AudioSampleRate = 48000;
	AudioCallbackBufferFrameSize = 1024;

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:629

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Low"))
	float LowSampleRate;

	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Min"))
	float MinSampleRate;

	// Scales all compression qualities when cooking to this platform. For example, 0.5 will halve all compression qualities, and 1.0 will leave them unchanged.
	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides")

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:36

Scope (from outer to inner):

file
function     UAndroidRuntimeSettings::UAndroidRuntimeSettings

Source code excerpt:

	, HighSampleRate(32000)
    , MedSampleRate(24000)
    , LowSampleRate(12000)
	, MinSampleRate(8000)
	, CompressionQualityModifier(1)
	, bMultiTargetFormat_ETC2(true)
	, bMultiTargetFormat_DXT(true)
	, bMultiTargetFormat_ASTC(true)
	, TextureFormatPriority_ETC2(0.2f)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioCompressionSettingsUtils.cpp:228

Scope (from outer to inner):

file
function     void CacheAudioCookOverrides

Source code excerpt:

	RetrievedSampleRate = -1.0f;

	PlatformFile.GetFloat(*CategoryName, TEXT("LowSampleRate"), RetrievedSampleRate);
	OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Low, RetrievedSampleRate);

	RetrievedSampleRate = -1.0f;

	PlatformFile.GetFloat(*CategoryName, TEXT("MinSampleRate"), RetrievedSampleRate);
	OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Min, RetrievedSampleRate);

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:576

Scope (from outer to inner):

file
class        class UIOSRuntimeSettings : public UObject

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Low"))
	float LowSampleRate;

	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Min"))
	float MinSampleRate;

	// Scales all compression qualities when cooking to this platform. For example, 0.5 will halve all compression qualities, and 1.0 will leave them unchanged.
	UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides")

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:21

Scope (from outer to inner):

file
function     UIOSRuntimeSettings::UIOSRuntimeSettings

Source code excerpt:

	, HighSampleRate(32000)
	, MedSampleRate(24000)
	, LowSampleRate(12000)
	, MinSampleRate(8000)
	, CompressionQualityModifier(1)
{
	bEnableGameCenterSupport = true;
	bEnableCloudKitSupport = false;
	bUserSwitching = false;