Table of Contents

Class WaveShaperNode

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The WaveShaperNode interface represents a non-linear distorter.

[Value("WaveShaperNode")]
public class WaveShaperNode : AudioNode
Inheritance
WaveShaperNode
Inherited Members

Remarks

It is an AudioNode that uses a curve to apply a wave shaping distortion to the signal. Beside obvious distortion effects, it is often used to add a warm feeling to the signal.

A WaveShaperNode always has exactly one input and one output.

-Using the Web Audio API

See also on MDN

Constructors

WaveShaperNode()

public WaveShaperNode()

WaveShaperNode(BaseAudioContext, WaveShaperOptions)

The WaveShaperNode() constructor
of the Web Audio API creates a new
WaveShaperNode object which is an AudioNode that
represents a non-linear distorter.

public WaveShaperNode(BaseAudioContext context, WaveShaperOptions options = null)

Parameters

context BaseAudioContext
options WaveShaperOptions

Remarks

Properties

Curve

The curve property of the WaveShaperNode interface is a {{jsxref("Float32Array")}} of numbers describing the distortion to apply.

[Value("curve")]
public Float32Array? Curve { get; set; }

Property Value

Float32Array

A Float32Array.

Remarks

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.

-Using the Web Audio API

See also on MDN

Oversample

The oversample property of the WaveShaperNode interface is an enumerated value indicating if oversampling must be used. Oversampling is a technique for creating more samples (up-sampling) before applying a distortion effect to the audio signal.

[Value("oversample")]
public OverSampleType Oversample { get; set; }

Property Value

OverSampleType

One of 'none', '2x', or '4x'.

Remarks

Once applied, the number of samples is reduced to its initial numbers. This leads to better results by avoiding some aliasing, but comes at the expense of a lower precision shaping curve.

The possible oversample values are:

Value

Effect

'none'

Do not perform any oversampling.

'2x'

Double the amount of samples before applying the shaping curve.

'4x'

Multiply by 4 the amount of samples before applying the shaping curve.

-Using the Web Audio API

See also on MDN