From 3287e3c031dd399f34ef3a16ee72393608524286 Mon Sep 17 00:00:00 2001 From: davotoula Date: Mon, 12 Jan 2026 22:46:03 +0100 Subject: [PATCH] =?UTF-8?q?add=20a=20=C2=B110%=20random=20variation=20to?= =?UTF-8?q?=20HIGH=20and=20DEEP=20pitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amethyst/ui/actions/uploads/VoiceAnonymizer.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/uploads/VoiceAnonymizer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/uploads/VoiceAnonymizer.kt index 1359f3318..ee036c482 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/uploads/VoiceAnonymizer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/uploads/VoiceAnonymizer.kt @@ -50,7 +50,6 @@ data class AnonymizedResult( class VoiceAnonymizer { companion object { private const val TAG = "VoiceAnonymizer" - private const val SAMPLE_RATE = 44100 private const val CHANNELS = 1 private const val BIT_RATE = 128000 } @@ -206,7 +205,16 @@ class VoiceAnonymizer { sampleRate: Int, onProgress: (Float) -> Unit, ): FloatArray { - val factor = preset.pitchFactor + val baseFactor = preset.pitchFactor + val factor = + when (preset) { + VoicePreset.DEEP, VoicePreset.HIGH -> { + // Add ±10% random variation + val randomShift = 0.9 + (Math.random() * 0.2) + baseFactor * randomShift + } + else -> baseFactor + } val processedSamples = mutableListOf() val totalSamples = pcmData.size