From 5486fc6a69544149b5994f455a8b542d670d241d Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:49:18 +0200 Subject: [PATCH] increase amplitude --- bitchat/Views/VoiceMessageRow.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bitchat/Views/VoiceMessageRow.swift b/bitchat/Views/VoiceMessageRow.swift index 76e7b1ab..91d39a9f 100644 --- a/bitchat/Views/VoiceMessageRow.swift +++ b/bitchat/Views/VoiceMessageRow.swift @@ -23,17 +23,21 @@ struct VoiceMessageRow: View { // Base waveform HStack(spacing: 2) { ForEach(Array(bins.enumerated()), id: \.offset) { _, v in - let h = max(2, CGFloat(v) * geo.size.height) + // Apply logarithmic normalization for better visibility of quiet recordings + let normalizedV = v <= 0 ? 0 : min(1.0, log(1.0 + v * 9.0) / log(10.0)) + let h = max(2, CGFloat(normalizedV) * geo.size.height) Capsule().fill(Color.gray.opacity(0.4)).frame(width: 2, height: h) } } - // Filled progress + // Filled progress (with normalized amplitude) let activeProgress = sendProgress ?? progress let filled = Int(Double(bins.count) * activeProgress) HStack(spacing: 2) { ForEach(0..