diff --git a/UwuRadio.Server/Constants.cs b/UwuRadio.Server/Constants.cs
index af0770b..ff68d2c 100644
--- a/UwuRadio.Server/Constants.cs
+++ b/UwuRadio.Server/Constants.cs
@@ -73,7 +73,7 @@ public static Constants
public double AudioNormIntegrated { get; set; }
///
- /// Allow to clip the audio by at most this much dB True Peak
+ /// Target loudness range
///
- public double AudioNormMaxClip { get; set; }
+ public double AudioNormLra { get; set; }
}
diff --git a/UwuRadio.Server/DSP.cs b/UwuRadio.Server/DSP.cs
index 0778911..8e6c56d 100644
--- a/UwuRadio.Server/DSP.cs
+++ b/UwuRadio.Server/DSP.cs
@@ -48,7 +48,7 @@ public static async Task MeasureLoudness(string path)
"-i",
path,
"-af",
- $"loudnorm=I={Constants.C.AudioNormIntegrated}:TP={Constants.C.AudioNormMaxClip}:print_format=json",
+ $"loudnorm=I={Constants.C.AudioNormIntegrated}:TP=0:LRA={Constants.C.AudioNormLra}:print_format=json",
"-f",
"null",
"-"
@@ -73,7 +73,7 @@ public static async Task Normalize(string inPath, string outPath, Loudnorm measu
"-i",
inPath,
"-af",
- $"loudnorm=I={Constants.C.AudioNormIntegrated}:TP={Constants.C.AudioNormMaxClip}"
+ $"loudnorm=I={Constants.C.AudioNormIntegrated}:TP=0:LRA={Constants.C.AudioNormLra}"
+ $":measured_I={measurement.I}:measured_TP={measurement.TP}"
+ $":measured_LRA={measurement.LRA}:measured_thresh={measurement.Thresh}"
+ $":offset={measurement.Oset}:linear=true",
diff --git a/UwuRadio.Server/constants.debug.json b/UwuRadio.Server/constants.debug.json
index b47a659..6b7460b 100644
--- a/UwuRadio.Server/constants.debug.json
+++ b/UwuRadio.Server/constants.debug.json
@@ -8,6 +8,6 @@
"IngestFolder": "../ingest",
"AudioFormat": "mp3",
"AudioQScale": "6",
- "AudioNormIntegrated": -9,
- "AudioNormMaxClip": 0
+ "AudioNormIntegrated": -10,
+ "AudioNormLra": 11
}
diff --git a/UwuRadio.Server/constants.json b/UwuRadio.Server/constants.json
index e46e067..dad84e8 100644
--- a/UwuRadio.Server/constants.json
+++ b/UwuRadio.Server/constants.json
@@ -8,6 +8,6 @@
"IngestFolder": "ingest",
"AudioFormat": "mp3",
"AudioQScale": "4",
- "AudioNormIntegrated": -9,
- "AudioNormMaxClip": 0
+ "AudioNormIntegrated": -10,
+ "AudioNormLra": 11
}