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
This commit is contained in:
Eric Rosenbaum committed 2019-09-27 14:26:14 -04:00
1 parent 5599626405
commit 523667dfaf
1 file changed
+1 -9
+1 -9
View File
@@ -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);
}
}