Skip to content

Commit 523667d

Browse files
committed
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
1 parent 5599626 commit 523667d

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/lib/audio/effects/volume-effect.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@ class VolumeEffect {
1414
this.gain.gain.setValueAtTime(volume, endSeconds);
1515
this.gain.gain.exponentialRampToValueAtTime(1.0, endSeconds + this.rampLength);
1616

17-
// Use a waveshaper node to prevent sample values from exceeding -1 or 1.
18-
// Without this, gain can cause samples to exceed this range, then they
19-
// are clipped on save, and the sound is distorted on load.
20-
this.waveShaper = this.audioContext.createWaveShaper();
21-
this.waveShaper.curve = new Float32Array([-1, 1]);
22-
this.waveShaper.oversample = 'none';
23-
2417
this.input.connect(this.gain);
25-
this.gain.connect(this.waveShaper);
26-
this.waveShaper.connect(this.output);
18+
this.gain.connect(this.output);
2719
}
2820
}
2921

0 commit comments

Comments
 (0)