function SoundFile(paths, onload, onerror, whileLoading) {
    soundfile_classCallCheck(this, SoundFile);
    if (typeof paths !== 'undefined') {
      if (typeof paths === 'string' || typeof paths[0] === 'string') {
        var path = p5.prototype._checkFileFormats(paths);
        this.url = path;
      } else if (soundfile_typeof(paths) === 'object') {
        if (!(window.File && window.FileReader && window.FileList && window.Blob)) {
          throw 'Unable to load file because the File API is not supported';
        }
      }

      if (paths.file) {
        paths = paths.file;
      }
      this.file = paths;
    }

    this._onended = function () {};
    this._looping = false;
    this._playing = false;
    this._paused = false;
    this._pauseTime = 0;

    this._cues = [];
    this._cueIDCounter = 0;

    this._lastPos = 0;
    this._counterNode = null;
    this._workletNode = null;

    this.bufferSourceNodes = [];

    this.bufferSourceNode = null;
    this.buffer = null;
    this.playbackRate = 1;
    this.input = main.audiocontext.createGain();
    this.output = main.audiocontext.createGain();
    this.reversed = false;

    this.startTime = 0;
    this.endTime = null;
    this.pauseTime = 0;

    this.mode = 'sustain';

    this.startMillis = null;

    this.panner = new panner_0();
    this.output.connect(this.panner);

    if (this.url || this.file) {
      this.load(onload, onerror);
    }

    main.soundArray.push(this);
    if (typeof whileLoading === 'function') {
      this._whileLoading = whileLoading;
    } else {
      this._whileLoading = function () {};
    }
    this._clearOnEnd = _clearOnEnd.bind(this);

    this.amp = this.setVolume;

    this.fade = this.setVolume;
  }
<p>SoundFile object with a path to a file.</p>

 <p>The p5.SoundFile may not be available immediately because
 it loads the file information asynchronously.</p>

 <p>To do something with the sound as soon as it loads
 pass the name of a function as the second parameter.</p>

 <p>Only one file path is required. However, audio file formats
 (i.e. mp3, ogg, wav and m4a/aac) are not supported by all
 web browsers. If you want to ensure compatability, instead of a single
 file path, you may include an Array of filepaths, and the browser will
 choose a format that works.</p>

 @class p5.SoundFile
 @constructor
 @param {String|Array} path   path to a sound file (String). Optionally,
                              you may include multiple file formats in
                              an array. Alternately, accepts an object
                              from the HTML5 File API, or a p5.File.
 @param {Function} [successCallback]   Name of a function to call once file loads
 @param {Function} [errorCallback]   Name of a function to call if file fails to
                                     load. This function will receive an error or
                                    XMLHttpRequest object with information
                                    about what went wrong.
 @param {Function} [whileLoadingCallback]   Name of a function to call while file
                                            is loading. That function will
                                            receive progress of the request to
                                            load the sound file
                                            (between 0 and 1) as its first
                                            parameter. This progress
                                            does not account for the additional
                                            time needed to decode the audio data.

 @example
 <div><code>
 let mySound;
 function preload() {
   soundFormats('mp3', 'ogg');
   mySound = loadSound('assets/doorbell');
 }

 function setup() {
   let cnv = createCanvas(100, 100);
   cnv.mousePressed(canvasPressed);
   background(220);
   text('tap here to play', 10, 20);
 }

 function canvasPressed() {
   // playing a sound file on a user gesture
   // is equivalent to `userStartAudio()`
   mySound.play();
 }
</code></div>