Skip to content

Encode recordings at a speech-oriented bitrate to shrink files - #4

Merged
dschuld merged 1 commit into
mainfrom
claude/recording-file-size-j40pku
Aug 2, 2026
Merged

Encode recordings at a speech-oriented bitrate to shrink files#4
dschuld merged 1 commit into
mainfrom
claude/recording-file-size-j40pku

Conversation

@dschuld

@dschuld dschuld commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Why

A 50-minute journal entry was producing a ~46 MB file. The recorder had been configured for 44.1 kHz at 128 kbps since the initial commit — music fidelity applied to a spoken-word journal:

128,000 bits/s ÷ 8 = 16 KB/s × 3000 s = 48,000,000 bytes ≈ 46 MB

That's roughly 4x more bitrate than voice needs, and it makes Drive uploads correspondingly slow.

What changed

MediaRecorderAudioRecorder now encodes mono / 22.05 kHz / 32 kbps AAC instead of 44.1 kHz / 128 kbps. Channel count is set explicitly rather than relying on the platform default (which was already mono, but was undocumented).

Setting 50 min 1 hour
128 kbps / 44.1 kHz (before) ~46 MB ~55 MB
32 kbps / 22.05 kHz (after) ~11 MB ~14 MB

Speech stays clearly intelligible at this rate and remains fine for transcription. Output is still AAC in an .m4a container, so nothing downstream changes — existing recordings play back exactly as before.

README updated to state the encoding settings and the resulting file size.

Testing

Not verified by a build: ./gradlew :app:testDebugUnitTest fails at configuration time in this environment because the Android Gradle plugin (com.android.application:9.2.1) cannot be resolved from the available repositories. That failure is independent of this change — it happens before any source is compiled. The diff is three MediaRecorder setter calls on APIs available since API 7, so worth a quick manual recording check after merge to confirm the audio quality is acceptable to you.


Generated by Claude Code

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WF5hfLpRQLQXoregs2cChs
@dschuld
dschuld merged commit 1af71e8 into main Aug 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants