Skip to content

Commit

Permalink
improve voice message quality
Browse files Browse the repository at this point in the history
see https://en.wikipedia.org/wiki/44,100_Hz

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
  • Loading branch information
mahibi committed Jan 23, 2023
1 parent 7d893cd commit 16af5c1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,9 @@ class ChatController(args: Bundle) :
setOutputFile(file)
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
setAudioSamplingRate(VOICE_MESSAGE_SAMPLE_RATE)
setAudioEncodingBitRate(VOICE_MESSAGE_BIT_RATE)
setAudioChannels(VOICE_MESSAGE_CHANNELS)

try {
prepare()
Expand Down Expand Up @@ -3412,6 +3415,9 @@ class ChatController(args: Bundle) :
private const val VOICE_RECORD_CANCEL_SLIDER_X: Int = -50
private const val VOICE_MESSAGE_META_DATA = "{\"messageType\":\"voice-message\"}"
private const val VOICE_MESSAGE_FILE_SUFFIX = ".mp3"
private const val VOICE_MESSAGE_SAMPLE_RATE = 44100
private const val VOICE_MESSAGE_CHANNELS = 1
private const val VOICE_MESSAGE_BIT_RATE = 32000
private const val FILE_DATE_PATTERN = "yyyy-MM-dd HH-mm-ss"
private const val VIDEO_SUFFIX = ".mp4"
private const val SHORT_VIBRATE: Long = 20
Expand Down

0 comments on commit 16af5c1

Please sign in to comment.