Encode recordings at a speech-oriented bitrate to shrink files - #4
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
That's roughly 4x more bitrate than voice needs, and it makes Drive uploads correspondingly slow.
What changed
MediaRecorderAudioRecordernow 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).Speech stays clearly intelligible at this rate and remains fine for transcription. Output is still AAC in an
.m4acontainer, 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:testDebugUnitTestfails 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 threeMediaRecordersetter 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