mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-18 18:25:03 +01:00
improve voice message quality
first it was tried with sampling rate 44100 but this showed an error on safari when try to playback. by direct comparison to 44100, 22050 has lower quality but it's totally okay compared to the quality before when no sampling rate was set. I'm not sure why it failed on safari, because the iOS app also uses 44100. see https://github.com/nextcloud/talk-android/pull/2714 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
e6757f397e
commit
86290d8f80
@ -1156,6 +1156,9 @@ class ChatController(args: Bundle) :
|
||||
setOutputFile(file)
|
||||
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
|
||||
setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
|
||||
setAudioSamplingRate(VOICE_MESSAGE_SAMPLING_RATE)
|
||||
setAudioEncodingBitRate(VOICE_MESSAGE_ENCODING_BIT_RATE)
|
||||
setAudioChannels(VOICE_MESSAGE_CHANNELS)
|
||||
|
||||
try {
|
||||
prepare()
|
||||
@ -3412,6 +3415,11 @@ 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"
|
||||
// Samplingrate 22050 was chosen because somehow 44100 failed to playback on safari when recorded on android.
|
||||
// Please test with firefox, chrome, safari and mobile clients if changing anything regarding the sound.
|
||||
private const val VOICE_MESSAGE_SAMPLING_RATE = 22050
|
||||
private const val VOICE_MESSAGE_ENCODING_BIT_RATE = 32000
|
||||
private const val VOICE_MESSAGE_CHANNELS = 1
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user