function Amplitude(smoothing) {
    amplitude_classCallCheck(this, Amplitude);
    this.bufferSize = safeBufferSize(2048);

    this.audiocontext = main.audiocontext;
    this._workletNode = new AudioWorkletNode(this.audiocontext, processorNames_default.a.amplitudeProcessor, {
      outputChannelCount: [1],
      parameterData: {
        smoothing: smoothing || 0
      },
      processorOptions: {
        normalize: false,
        smoothing: smoothing || 0,
        numInputChannels: 2,
        bufferSize: this.bufferSize
      }
    });
    this._workletNode.port.onmessage = function (event) {
      if (event.data.name === 'amplitude') {
        this.volume = event.data.volume;
        this.volNorm = event.data.volNorm;
        this.stereoVol = event.data.stereoVol;
        this.stereoVolNorm = event.data.stereoVolNorm;
      }
    }.bind(this);

    this.input = this._workletNode;
    this.output = this.audiocontext.createGain();

    this.volume = 0;
    this.volNorm = 0;
    this.stereoVol = [0, 0];
    this.stereoVolNorm = [0, 0];
    this.normalize = false;
    this._workletNode.connect(this.output);
    this.output.gain.value = 0;

    this.output.connect(this.audiocontext.destination);

    main.meter.connect(this._workletNode);

    main.soundArray.push(this);
  }
Amplitude measures volume between 0.0 and 1.0.
 Listens to all p5sound by default, or use setInput()
 to listen to a specific sound source. Accepts an optional
 smoothing value, which defaults to 0.

 @class p5.Amplitude
 @constructor
 @param {Number} [smoothing] between 0.0 and .999 to smooth
                            amplitude readings (defaults to 0)
 @example
 <div><code>
 let sound, amplitude;

 function preload(){
   sound = loadSound('assets/beat.mp3');
 }
 function setup() {
   let cnv = createCanvas(100,100);
   cnv.mouseClicked(togglePlay);
   amplitude = new p5.Amplitude();
 }

 function draw() {
   background(220);
   text('tap to play', 20, 20);

   let level = amplitude.getLevel();
   let size = map(level, 0, 1, 0, 200);
   ellipse(width/2, height/2, size, size);
 }

 function togglePlay() {
   if (sound.isPlaying() ){
     sound.pause();
   } else {
     sound.loop();
		amplitude = new p5.Amplitude();
		amplitude.setInput(sound);
   }
 }

 </code></div>