Include waveform when sending voice messages (#1650)

- New `AudioLevelCalculator` that outputs dB0v rescaled to the [0;1] range.
- `VoiceRecorder` now stores the audio levels sampled while recording, then resamples them to 100 samples to use as waveform preview.
- Waveform data is carried all the way as a `List<Float>` and converted to `List<Int>` in the [0;1024] range as per matrix spec only before sending it.
This commit is contained in:
Marco Romano
2023-10-26 17:37:24 +02:00
committed by GitHub
parent a67410f573
commit 00d24ce4b1
11 changed files with 199 additions and 70 deletions
@@ -38,9 +38,11 @@ sealed class VoiceRecorderState {
*
* @property file The recorded file.
* @property mimeType The mime type of the file.
* @property waveform The waveform of the recording.
*/
data class Finished(
val file: File,
val mimeType: String,
val waveform: List<Float>,
) : VoiceRecorderState()
}