翻译不完整。 请帮助我们翻译这篇文章!

WaveShaperNode 接口的 oversample 属性是一个指示过采样是否必须使用的枚举值。 过采样是一个用于在将畸变应用到音频信号之前创建更多的采样(上采样)的技术。

一旦被应用, 采样的数值会被还原为初始的数值。 这将通过避免一些混淆现象从而导致更好的结果, 代价则是在畸变曲线上会有较低的精确度。

 可用的oversample 值有:

Value Effect
'none' 不使用过采样。
'2x' 在应用畸变曲线前将采样的数量翻倍。
'4x' 在应用畸变曲线前将采样的数量翻4倍。


distortion.oversample = enumeratedValue;

  • 畸变是一个WaveShaperNode.
  • 枚举值'none''2x', 或 '4x'


The following example shows basic usage of an AudioContext to create a wave shaper node. For applied examples/information, check out our Voice-change-O-matic demo (see app.js for relevant code).

Note: Sigmoid functions are commonly used for distortion curves because of their natural properties. Their S-shape, for instance, helps create a smoother sounding result. We found the below distortion curve code on Stack Overflow.

var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var distortion = audioCtx.createWaveShaper();


function makeDistortionCurve(amount) {
  var k = typeof amount === 'number' ? amount : 50,
    n_samples = 44100,
    curve = new Float32Array(n_samples),
    deg = Math.PI / 180,
    i = 0,
  for ( ; i < n_samples; ++i ) {
    x = i * 2 / n_samples - 1;
    curve[i] = ( 3 + k ) * x * 20 * deg / ( Math.PI + k * Math.abs(x) );
  return curve;


distortion.curve = makeDistortionCurve(400);
distortion.oversample = '4x';


Specification Status Comment
Web Audio API
Working Draft  


Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
oversampleChrome Full support 14Edge Full support 12Firefox Full support 26IE No support NoOpera Full support 15Safari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 26Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android Full support 1.0


Full support  
Full support
No support  
No support