WaveShaperNode.curve

The curve property of the WaveShaperNode interface is a Float32Array of numbers describing the distortion to apply.

The mid-element of the array is applied to any signal value of 0, the first one to signal values of -1, and the last to signal values of 1; values lower than -1 or greater than 1 are treated like -1 or 1 respectively.

If necessary, intermediate values of the distortion curve are linearly interpolated.

Note: The array can be a null value: in that case, no distortion is applied to the input signal.

Syntax

var audioCtx = new AudioContext();
var distortion = audioCtx.createWaveShaper();
distortion.curve = myCurveDataArray; // myCurveDataArray is a Float32Array

Value

A Float32Array.

Example

See BaseAudioContext.createWaveShaper() for example code.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
curve
14
12
25
No
15
6
≤37
18
25
14
Yes
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curve