From 523667dfafbef1cf12be733862897007dffc42c8 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Fri, 27 Sep 2019 14:26:14 -0400 Subject: [PATCH] Remove waveshaper from volume effect the waveshaper node is implemented incorrectly on Mac Safari (https://bugs.webkit.org/show_bug.cgi?id=129333) and causes extreme distortion of the sound --- src/lib/audio/effects/volume-effect.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib/audio/effects/volume-effect.js b/src/lib/audio/effects/volume-effect.js index a5d12a987..0cfcd6415 100644 --- a/src/lib/audio/effects/volume-effect.js +++ b/src/lib/audio/effects/volume-effect.js @@ -14,16 +14,8 @@ class VolumeEffect { this.gain.gain.setValueAtTime(volume, endSeconds); this.gain.gain.exponentialRampToValueAtTime(1.0, endSeconds + this.rampLength); - // Use a waveshaper node to prevent sample values from exceeding -1 or 1. - // Without this, gain can cause samples to exceed this range, then they - // are clipped on save, and the sound is distorted on load. - this.waveShaper = this.audioContext.createWaveShaper(); - this.waveShaper.curve = new Float32Array([-1, 1]); - this.waveShaper.oversample = 'none'; - this.input.connect(this.gain); - this.gain.connect(this.waveShaper); - this.waveShaper.connect(this.output); + this.gain.connect(this.output); } }