mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 01:05:20 +00:00
lower voice quality, smaller file size (#483)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package com.bitchat.android.features.voice
|
package com.bitchat.android.features.voice
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -37,9 +38,10 @@ class VoiceRecorder(private val context: Context) {
|
|||||||
rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
|
rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
|
||||||
rec.setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
|
rec.setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
|
||||||
rec.setAudioChannels(1)
|
rec.setAudioChannels(1)
|
||||||
rec.setAudioSamplingRate(44100)
|
// Target: 16 kHz AAC @ 20 kbps ≈ 2.5 KB/sec
|
||||||
// Lower bitrate to keep BLE payloads <= 32KiB for fragmentation
|
// Lower sample rate and bitrate for compact, speech-optimized recordings
|
||||||
rec.setAudioEncodingBitRate(32_000)
|
rec.setAudioSamplingRate(16000)
|
||||||
|
rec.setAudioEncodingBitRate(20_000)
|
||||||
rec.setOutputFile(file.absolutePath)
|
rec.setOutputFile(file.absolutePath)
|
||||||
rec.prepare()
|
rec.prepare()
|
||||||
rec.start()
|
rec.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user