MedSampleRate
MedSampleRate
#Overview
name: MedSampleRate
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 MedSampleRate is to define the medium-quality sample rate for audio processing in Unreal Engine 5. This setting is part of the audio system’s resampling quality configuration.
MedSampleRate is used in multiple platform-specific modules within Unreal Engine, including WindowsTargetPlatform, AndroidRuntimeSettings, and IOSRuntimeSettings. This indicates that it’s a cross-platform setting used to configure audio quality for different target platforms.
The value of this variable is typically set in the constructor of the respective platform settings classes (UWindowsTargetSettings, UAndroidRuntimeSettings, UIOSRuntimeSettings). In the provided code snippets, it’s initialized to 24000 Hz.
MedSampleRate interacts with other sample rate variables such as MaxSampleRate, HighSampleRate, LowSampleRate, and MinSampleRate. These variables together form a hierarchy of audio quality settings that can be used to optimize performance and audio quality based on the target platform and device capabilities.
Developers should be aware that this variable is part of the audio cook overrides and resampling quality settings. It’s used to determine the appropriate sample rate for medium-quality audio processing, which can affect both audio quality and performance.
Best practices when using this variable include:
- Consider the target platform’s capabilities and typical use cases when adjusting this value.
- Balance audio quality with performance requirements, especially for mobile platforms.
- Test thoroughly with different audio assets to ensure the chosen sample rate provides satisfactory results.
- Coordinate changes to this variable with other sample rate settings to maintain a logical hierarchy of audio quality options.
- Be aware of how changes to this setting might affect the overall size of your game’s audio data and loading times.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:317, section: [/Script/WindowsTargetPlatform.WindowsTargetSettings]
- INI Section:
/Script/WindowsTargetPlatform.WindowsTargetSettings
- Raw value:
24000.000000
- Is Array:
False
#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:126
Scope (from outer to inner):
file
class class UWindowsTargetSettings : public UObject
Source code excerpt:
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Medium"))
float MedSampleRate;
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Low"))
float LowSampleRate;
UPROPERTY(GlobalConfig, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Min"))
float MinSampleRate;
#Loc: <Workspace>/Engine/Source/Developer/Windows/WindowsTargetPlatform/Private/WindowsTargetPlatformClasses.cpp:10
Scope (from outer to inner):
file
function UWindowsTargetSettings::UWindowsTargetSettings
Source code excerpt:
, MaxSampleRate(48000)
, HighSampleRate(32000)
, MedSampleRate(24000)
, LowSampleRate(12000)
, MinSampleRate(8000)
, CompressionQualityModifier(1)
{
// Default windows settings
AudioSampleRate = 48000;
#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:626
Scope (from outer to inner):
file
class class UAndroidRuntimeSettings : public UObject
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Medium"))
float MedSampleRate;
UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Low"))
float LowSampleRate;
UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Min"))
float MinSampleRate;
#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Private/AndroidRuntimeSettings.cpp:35
Scope (from outer to inner):
file
function UAndroidRuntimeSettings::UAndroidRuntimeSettings
Source code excerpt:
, MaxSampleRate(48000)
, HighSampleRate(32000)
, MedSampleRate(24000)
, LowSampleRate(12000)
, MinSampleRate(8000)
, CompressionQualityModifier(1)
, bMultiTargetFormat_ETC2(true)
, bMultiTargetFormat_DXT(true)
, bMultiTargetFormat_ASTC(true)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioCompressionSettingsUtils.cpp:223
Scope (from outer to inner):
file
function void CacheAudioCookOverrides
Source code excerpt:
RetrievedSampleRate = -1.0f;
PlatformFile.GetFloat(*CategoryName, TEXT("MedSampleRate"), RetrievedSampleRate);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Medium, RetrievedSampleRate);
RetrievedSampleRate = -1.0f;
PlatformFile.GetFloat(*CategoryName, TEXT("LowSampleRate"), RetrievedSampleRate);
OutOverrides.PlatformSampleRates.Add(ESoundwaveSampleRateSettings::Low, RetrievedSampleRate);
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:573
Scope (from outer to inner):
file
class class UIOSRuntimeSettings : public UObject
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Medium"))
float MedSampleRate;
UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Low"))
float LowSampleRate;
UPROPERTY(config, EditAnywhere, Category = "Audio|CookOverrides|ResamplingQuality", meta = (DisplayName = "Min"))
float MinSampleRate;
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:20
Scope (from outer to inner):
file
function UIOSRuntimeSettings::UIOSRuntimeSettings
Source code excerpt:
, MaxSampleRate(48000)
, HighSampleRate(32000)
, MedSampleRate(24000)
, LowSampleRate(12000)
, MinSampleRate(8000)
, CompressionQualityModifier(1)
{
bEnableGameCenterSupport = true;
bEnableCloudKitSupport = false;