Improve visible waveform for voice messages

This tries to prioritize actual voice to decide the waveform, and clamps noise to zero to ensure the waveform doesn't have a perceptually noisy base.

In theory this better matches the overall voice message content.
This commit is contained in:
Travis Ralston 2021-05-13 22:20:08 -06:00
parent e38d27f64e
commit df7b598ca7
3 changed files with 27 additions and 14 deletions

View file

@ -75,7 +75,8 @@ export function arraySmoothingResample(input: number[], points: number): number[
for (let i = 1; i < input.length - 1; i += 2) {
const prevPoint = input[i - 1];
const nextPoint = input[i + 1];
const average = (prevPoint + nextPoint) / 2;
const currPoint = input[i];
const average = (prevPoint + nextPoint + currPoint) / 3;
samples.push(average);
}
input = samples;