function Distortion(amount, oversample) {
    var _this;
    distortion_classCallCheck(this, Distortion);
    _this = _super.call(this);
    if (typeof amount === 'undefined') {
      amount = 0.25;
    }
    if (typeof amount !== 'number') {
      throw new Error('amount must be a number');
    }
    if (typeof oversample === 'undefined') {
      oversample = '2x';
    }
    if (typeof oversample !== 'string') {
      throw new Error('oversample must be a String');
    }
    var curveAmount = p5.prototype.map(amount, 0.0, 1.0, 0, 2000);

    /**
     *  The p5.Distortion is built with a
     *  <a href="http://www.w3.org/TR/webaudio/#WaveShaperNode">
     *  Web Audio WaveShaper Node</a>.
     *
     *  @property {AudioNode} WaveShaperNode
     */
    _this.waveShaperNode = _this.ac.createWaveShaper();
    _this.amount = amount;
    _this.waveShaperNode.curve = makeDistortionCurve(curveAmount);
    _this.waveShaperNode.oversample = oversample;
    _this.input.connect(_this.waveShaperNode);
    _this.waveShaperNode.connect(_this.wet);
    return _this;
  }
A Distortion effect created with a Waveshaper Node,
with an approach adapted from
[Kevin Ennis](http://stackoverflow.com/questions/22312841/waveshaper-node-in-webaudio-how-to-emulate-distortion)

This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.
Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>,
<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and
<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.

@class p5.Distortion
@extends p5.Effect
@constructor
@param {Number} [amount] Unbounded distortion amount.
                               Normal values range from 0-1 (defaults to 0.25)
@param {String} [oversample] 'none', '2x' (default), or '4x'.
 @example
 <div><code>
 let osc, distortion, fft;

 function setup() {
   let cnv = createCanvas(100, 100);
   fft = new p5.FFT(0, 256);

   osc = new p5.TriOsc();
   osc.amp(0.3);
   osc.freq(375);

   distortion = new p5.Distortion();
   distortion.process(osc);
   cnv.mousePressed(oscStart);
 }

 function draw() {
   background(220);
   // set the amount based on mouseX
   let amount = constrain(map(mouseX, 0, width, 0, 1), 0, 1);

   // multiply the amount to smooth the value
   distortion.set(amount * amount);

   noStroke();
   fill(0);
   text('tap to play', 10, 20);
   text('amount: ' + amount, 10, 40);

   // draw the waveform
   var samples = fft.waveform();
   drawOscilloscope(samples);
 }

 //function based on distortion example
 function drawOscilloscope(samples) {
   var yTranslateScope = 20;
   var scopeWidth = width;
   var scopeHeight = height;

   stroke(0);
   strokeWeight(1);
   noFill();

   beginShape();
   for (var sampleIndex in samples) {
     var x = map(sampleIndex, 0, samples.length, 0, scopeWidth);
     var y = map(samples[sampleIndex], -1, 1, -scopeHeight / 4, scopeHeight / 4);
     vertex(x, y + scopeHeight / 2 + yTranslateScope);
   }
   endShape();
 }

 function oscStart() {
   osc.start();
 }

 function mouseReleased() {
   osc.stop();
 }

 </code></div>