From 5651bdc87d5458704cba2c2064f6129d6fc0d828 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 2 Aug 2026 15:50:01 +0000 Subject: [PATCH] Encode recordings at speech-oriented bitrate to shrink files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MediaRecorder was configured for 44.1 kHz at 128 kbps, which is music fidelity applied to a spoken-word journal. That works out to 16 KB/s, so a 50-minute entry produced a ~46 MB file — slow to upload to Drive and needlessly large on device. Switch to mono, 22.05 kHz, 32 kbps AAC, which stays clearly intelligible for voice while cutting file size 4x (~11 MB for the same 50 minutes). Channel count is now set explicitly rather than relying on the platform default. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01WF5hfLpRQLQXoregs2cChs --- README.md | 5 +++-- .../java/com/audiojournal/app/recording/AudioRecorder.kt | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 836d2b6..3843d3f 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,9 @@ optionally) in the background. other apps (you'll see an ongoing notification). - **Pause / resume** — while recording, a pause button appears next to the stop button. -- **Stop** — finalizes the recording as an AAC `.m4a` file (small files, - playable everywhere) named like `recording_2026-07-09_14-30-00.m4a`. +- **Stop** — finalizes the recording as an AAC `.m4a` file named like + `recording_2026-07-09_14-30-00.m4a`. Encoding is tuned for speech — mono, + 22.05 kHz, 32 kbps — so an hour of journalling is roughly 14 MB. - **Automatic cloud upload** — when you stop, the file is queued with WorkManager and uploaded to your **Google Drive** (or an AWS S3 bucket if you switch backends). If you're offline, the upload waits for connectivity diff --git a/app/src/main/java/com/audiojournal/app/recording/AudioRecorder.kt b/app/src/main/java/com/audiojournal/app/recording/AudioRecorder.kt index 27eda64..a3ccf5d 100644 --- a/app/src/main/java/com/audiojournal/app/recording/AudioRecorder.kt +++ b/app/src/main/java/com/audiojournal/app/recording/AudioRecorder.kt @@ -41,8 +41,11 @@ class MediaRecorderAudioRecorder(private val context: Context) : AudioRecorder { recorder.setAudioSource(MediaRecorder.AudioSource.MIC) recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4) recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC) - recorder.setAudioSamplingRate(44_100) - recorder.setAudioEncodingBitRate(128_000) + // Voice-oriented settings: a spoken-word journal does not need music + // fidelity, and these keep a one-hour entry around 14 MB instead of 58 MB. + recorder.setAudioChannels(1) + recorder.setAudioSamplingRate(22_050) + recorder.setAudioEncodingBitRate(32_000) recorder.setOutputFile(output.absolutePath) try { recorder.prepare()