From d7ca99ae5deb898b4a486c8546a1c6f13c9879a4 Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 1 Oct 2025 02:09:15 +0200 Subject: [PATCH] Optimize voice note codec to 16 kHz / 20 kbps for smaller file sizes - Reduce sample rate from 44.1 kHz to 16 kHz (telephony standard) - Lower bitrate from 32 kbps to 20 kbps - Results in ~37% file size reduction (~150 KB/min vs 240 KB/min) - Increases max voice note length from 4.4 to 7 minutes over 1 MiB BLE limit - Maintains excellent voice quality using native AAC-LC codec --- bitchat/Features/voice/VoiceRecorder.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitchat/Features/voice/VoiceRecorder.swift b/bitchat/Features/voice/VoiceRecorder.swift index 478e1d2a..9616ab82 100644 --- a/bitchat/Features/voice/VoiceRecorder.swift +++ b/bitchat/Features/voice/VoiceRecorder.swift @@ -73,9 +73,9 @@ final class VoiceRecorder: NSObject, AVAudioRecorderDelegate { let outputURL = try makeOutputURL() let settings: [String: Any] = [ AVFormatIDKey: kAudioFormatMPEG4AAC, - AVSampleRateKey: 44_100, + AVSampleRateKey: 16_000, AVNumberOfChannelsKey: 1, - AVEncoderBitRateKey: 32_000 + AVEncoderBitRateKey: 20_000 ] let audioRecorder = try AVAudioRecorder(url: outputURL, settings: settings)