function SoundRecorder() {
    soundRecorder_classCallCheck(this, SoundRecorder);
    this.input = soundRecorder_ac.createGain();
    this.output = soundRecorder_ac.createGain();
    this._inputChannels = 2;
    this._outputChannels = 2; 

    var workletBufferSize = this.bufferSize = safeBufferSize(1024);
    this._workletNode = new AudioWorkletNode(soundRecorder_ac, processorNames_default.a.recorderProcessor, {
      outputChannelCount: [this._outputChannels],
      processorOptions: {
        numInputChannels: this._inputChannels,
        bufferSize: workletBufferSize
      }
    });
    this._workletNode.port.onmessage = function (event) {
      if (event.data.name === 'buffers') {
        var buffers = [new Float32Array(event.data.leftBuffer), new Float32Array(event.data.rightBuffer)];
        this._callback(buffers);
      }
    }.bind(this);

    /**
     *  callback invoked when the recording is over
     *  @private
     *  @type Function(Float32Array)
     */
    this._callback = function () {};

    this._workletNode.connect(p5.soundOut._silentNode);
    this.setInput();

    main.soundArray.push(this);
  }
<p>Record sounds for playback and/or to save as a .wav file.
 The p5.SoundRecorder records all sound output from your sketch,
 or can be assigned a specific source with setInput().</p>
 <p>The record() method accepts a p5.SoundFile as a parameter.
 When playback is stopped (either after the given amount of time,
 or with the stop() method), the p5.SoundRecorder will send its
 recording to that p5.SoundFile for playback.</p>

 @class p5.SoundRecorder
 @constructor
 @example
 <div><code>
 let mic, recorder, soundFile;
 // keeps record if recording is started
 let isRecordingStarted = false;
 // keeps record if the recorded result is played
 let isResultPlayed = false;

 function setup() {
   let cnv = createCanvas(100, 100);
   cnv.mousePressed(canvasPressed);
   background(220);
   textAlign(CENTER, CENTER);

   // create an audio in
   mic = new p5.AudioIn();

   // create a sound recorder
   recorder = new p5.SoundRecorder();

   // connect the mic to the recorder
   recorder.setInput(mic);

   // this sound file will be used to
   // playback & save the recording
   soundFile = new p5.SoundFile();

   text('tap to record', width/2, height/2);
 }

 function canvasPressed() {
   // ensure audio is enabled
   userStartAudio();

   if (!isRecordingStarted && !isResultPlayed) {
   // make sure user enabled the mic by prompting to enable their browser mic
   // start recording after the mic is enabled
     mic.start(function() {
       // record to our p5.SoundFile
       recorder.record(soundFile);

       background(255,0,0);
       text('Recording!', width/2, height/2);
       isRecordingStarted = true;
     });
   }
   else if (isRecordingStarted && !isResultPlayed) {
     background(0,255,0);

     // stop recorder and
     // send result to soundFile
     recorder.stop();
     // stop browser from accessing the mic
     mic.dispose();

     text('Done! Tap to play and download', width/2, height/2, width - 20);
     isResultPlayed = true;
   }

   else if (isRecordingStarted && isResultPlayed) {
     soundFile.play(); // play the result!
     save(soundFile, 'mySound.wav');
   }
 }
 </div></code>