Update src/voice/RecorderWorklet.ts to use sanity
Co-authored-by: Germain <germain@souquet.com>
This commit is contained in:
parent
4f75e2944c
commit
b519d85127
1 changed files with 2 additions and 2 deletions
|
@ -44,8 +44,8 @@ class MxVoiceWorklet extends AudioWorkletProcessor {
|
||||||
// waveform.
|
// waveform.
|
||||||
//
|
//
|
||||||
// We translate the amplitude down to 0-1 for sanity's sake.
|
// We translate the amplitude down to 0-1 for sanity's sake.
|
||||||
const minVal = monoChan.reduce((m, v) => Math.min(m, v), Number.MAX_SAFE_INTEGER);
|
const minVal = Math.min(...monoChan);
|
||||||
const maxVal = monoChan.reduce((m, v) => Math.max(m, v), Number.MIN_SAFE_INTEGER);
|
const maxVal = Math.max(...monoChan);
|
||||||
const amplitude = percentageOf(maxVal, -1, 1) - percentageOf(minVal, -1, 1);
|
const amplitude = percentageOf(maxVal, -1, 1) - percentageOf(minVal, -1, 1);
|
||||||
|
|
||||||
this.port.postMessage(<IAmplitudePayload>{
|
this.port.postMessage(<IAmplitudePayload>{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue