lower bitrate for voice recordings

This commit is contained in:
Daniel Gultsch 2024-02-09 17:54:25 +01:00
parent cd1821f2b6
commit 75f42d680d
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -116,19 +116,19 @@ public class RecordingActivity extends Activity implements View.OnClickListener
outputFormat = MediaRecorder.OutputFormat.OGG; outputFormat = MediaRecorder.OutputFormat.OGG;
mRecorder.setOutputFormat(outputFormat); mRecorder.setOutputFormat(outputFormat);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.OPUS); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.OPUS);
mRecorder.setAudioEncodingBitRate(32000); mRecorder.setAudioEncodingBitRate(32_000);
} else { } else {
outputFormat = MediaRecorder.OutputFormat.MPEG_4; outputFormat = MediaRecorder.OutputFormat.MPEG_4;
mRecorder.setOutputFormat(outputFormat); mRecorder.setOutputFormat(outputFormat);
if (AAC_SENSITIVE_DEVICES.contains(Build.MODEL)) { if (AAC_SENSITIVE_DEVICES.contains(Build.MODEL)) {
// Changing these three settings for AAC sensitive devices might lead to sporadically truncated (cut-off) voice messages. // Changing these three settings for AAC sensitive devices might lead to sporadically truncated (cut-off) voice messages.
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC);
mRecorder.setAudioSamplingRate(24000); mRecorder.setAudioSamplingRate(24_000);
mRecorder.setAudioEncodingBitRate(28000); mRecorder.setAudioEncodingBitRate(28_000);
} else { } else {
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mRecorder.setAudioSamplingRate(22050); mRecorder.setAudioSamplingRate(22_050);
mRecorder.setAudioEncodingBitRate(96000); mRecorder.setAudioEncodingBitRate(64_000);
} }
} }
setupOutputFile(outputFormat); setupOutputFile(outputFormat);