A cross platform Audiobookshelf client for Android and iOS
Dart
Make the loudness boost stop sounding gravelly on loud words
Barnabas0e9badfe3e8d
diff --git a/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/GainAudioProcessor.java b/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/GainAudioProcessor.javaindex 077fa92c..c0ab57d6 100644--- a/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/GainAudioProcessor.java+++ b/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/GainAudioProcessor.java@@ -98,7 +98,7 @@ public final class GainAudioProcessor extends BaseAudioProcessor {output.flip();}- // The limiter runs 5 ms behind, so the end of the audio is still inside+ // The limiter runs 20 ms behind, so the end of the audio is still inside// it when the input stops. Same shape as media3's TrimmingAudioProcessor.@Overridepublic ByteBuffer getOutput() {diff --git a/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/PeakLimiter.java b/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/PeakLimiter.javaindex 6a1e2a47..77f08d2f 100644--- a/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/PeakLimiter.java+++ b/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/PeakLimiter.java@@ -4,16 +4,19 @@ import java.util.Arrays;/*** Absorb patch: lookahead peak limiter behind the loudness gain. The audio is- * held back 5 ms so the gain can ease down before a peak comes out and recover+ * held back 20 ms so the gain can ease down before a peak comes out and recover* slowly after it. Clipping the boosted samples one by one squared off every* loud syllable, which came out as static on a book mastered near full scale.+ * A 5 ms grab with a 200 ms recovery still dipped and bounced back on each+ * word, which sounded gravelly; the slower pair holds the level through a+ * phrase instead.* All channels share one gain so the stereo image stays put. No Android types* in here so it compiles and tests on its own.*/final class PeakLimiter {static final float CEILING = 0.891f; // -1 dBFS- private static final float LOOKAHEAD_SEC = 0.005f;- private static final float RELEASE_SEC = 0.2f;+ private static final float LOOKAHEAD_SEC = 0.02f;+ private static final float RELEASE_SEC = 1.0f;private final int channels;private final int lookahead;