function SoundLoop(callback, interval) {
    soundLoop_classCallCheck(this, SoundLoop);
    /**
     * Getters and Setters, setting any paramter will result in a change in the clock's
     * frequency, that will be reflected after the next callback
     * beats per minute (defaults to 60)
     * @property {Number} bpm
     * @for p5.SoundLoop
     */
    Object.defineProperty(this, 'bpm', {
      get: function get() {
        return this._bpm;
      },
      set: function set(bpm) {
        if (!this.musicalTimeMode) {
          console.warn('Changing the BPM in "seconds" mode has no effect. ' + 'BPM is only relevant in musicalTimeMode ' + 'when the interval is specified as a string ' + '("2n", "4n", "1m"...etc)');
        }
        this._bpm = bpm;
        this._update();
      }
    });

    /**
     * number of quarter notes in a measure (defaults to 4)
     * @property {Number} timeSignature
     * @for p5.SoundLoop
     */
    Object.defineProperty(this, 'timeSignature', {
      get: function get() {
        return this._timeSignature;
      },
      set: function set(timeSig) {
        if (!this.musicalTimeMode) {
          console.warn('Changing the timeSignature in "seconds" mode has no effect. ' + 'BPM is only relevant in musicalTimeMode ' + 'when the interval is specified as a string ' + '("2n", "4n", "1m"...etc)');
        }
        this._timeSignature = timeSig;
        this._update();
      }
    });

    /**
     * length of the loops interval
     * @property {Number|String} interval
     * @for p5.SoundLoop
     */
    Object.defineProperty(this, 'interval', {
      get: function get() {
        return this._interval;
      },
      set: function set(interval) {
        this.musicalTimeMode = typeof interval === 'number' ? false : true;
        this._interval = interval;
        this._update();
      }
    });

    /**
     * how many times the callback has been called so far
     * @property {Number} iterations
     * @for p5.SoundLoop
     * @readonly
     */
    Object.defineProperty(this, 'iterations', {
      get: function get() {
        return this.clock.ticks;
      }
    });
    this.callback = callback;
    /**
     * musicalTimeMode uses <a href = "https://github.com/Tonejs/Tone.js/wiki/Time">Tone.Time</a> convention
     * true if string, false if number
     * @property {Boolean} musicalTimeMode
     */
    this.musicalTimeMode = typeof this._interval === 'number' ? false : true;
    this._interval = interval || 1;

    /**
     * musicalTimeMode variables
     * modify these only when the interval is specified in musicalTime format as a string
     */
    this._timeSignature = 4;
    this._bpm = 60;
    this.isPlaying = false;

    /**
     * Set a limit to the number of loops to play. defaults to Infinity
     * @property {Number} maxIterations
     */
    this.maxIterations = Infinity;
    var self = this;
    this.clock = new Clock_default.a({
      callback: function callback(time) {
        var timeFromNow = time - main.audiocontext.currentTime;
        /**
         * Do not initiate the callback if timeFromNow is < 0
         * This ususually occurs for a few milliseconds when the page
         * is not fully loaded
         *
         * The callback should only be called until maxIterations is reached
         */
        if (timeFromNow > 0 && self.iterations <= self.maxIterations && self.callback) {
          self.callback(timeFromNow);
        }
      },
      frequency: this._calcFreq()
    });
  }
SoundLoop

@class p5.SoundLoop
@constructor

@param {Function} callback this function will be called on each iteration of theloop
@param {Number|String} [interval] amount of time (if a number) or beats (if a string, following <a href = "https://github.com/Tonejs/Tone.js/wiki/Time">Tone.Time</a> convention) for each iteration of the loop. Defaults to 1 second.

@example
<div><code>
 let synth, soundLoop;
 let notePattern = [60, 62, 64, 67, 69, 72];

 function setup() {
   let cnv = createCanvas(100, 100);
   cnv.mousePressed(canvasPressed);
   colorMode(HSB);
   background(0, 0, 86);
   text('tap to start/stop', 10, 20);

   //the looper's callback is passed the timeFromNow
   //this value should be used as a reference point from
   //which to schedule sounds
   let intervalInSeconds = 0.2;
   soundLoop = new p5.SoundLoop(onSoundLoop, intervalInSeconds);

   synth = new p5.MonoSynth();
}

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

  if (soundLoop.isPlaying) {
    soundLoop.stop();
  } else {
    // start the loop
    soundLoop.start();
  }
}

function onSoundLoop(timeFromNow) {
  let noteIndex = (soundLoop.iterations - 1) % notePattern.length;
  let note = midiToFreq(notePattern[noteIndex]);
  synth.play(note, 0.5, timeFromNow);
  background(noteIndex * 360 / notePattern.length, 50, 100);
}
</code></div>