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
This commit is contained in:
jack
2025-10-14 22:30:10 +02:00
parent f9a218d68b
commit d76472999d
+2 -2
View File
@@ -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)