rate(playbackRate) {
    var reverse = false;
    if (typeof playbackRate === 'undefined') {
      return this.playbackRate;
    }

    this.playbackRate = playbackRate;

    if (playbackRate === 0) {
      playbackRate = 0.0000000000001;
    } else if (playbackRate < 0 && !this.reversed) {
      playbackRate = Math.abs(playbackRate);
      reverse = true;
    } else if (playbackRate > 0 && this.reversed) {
      reverse = true;
    }

    if (this.bufferSourceNode) {
      var now = p5sound.audiocontext.currentTime;
      this.bufferSourceNode.playbackRate.cancelScheduledValues(now);
      this.bufferSourceNode.playbackRate.linearRampToValueAtTime(
        Math.abs(playbackRate),
        now
      );
      this._counterNode.playbackRate.cancelScheduledValues(now);
      this._counterNode.playbackRate.linearRampToValueAtTime(
        Math.abs(playbackRate),
        now
      );
    }

    if (reverse) {
      this.reverseBuffer();
    }
    return this.playbackRate;
  }
Set the playback rate of a sound file. Will change the speed and the pitch.
 Values less than zero will reverse the audio buffer.

 @method rate
 @for p5.SoundFile
 @param {Number} [playbackRate]     Set the playback rate. 1.0 is normal,
                                    .5 is half-speed, 2.0 is twice as fast.
                                    Values less than zero play backwards.
 @example
 <div><code>
 let mySound;

 function preload() {
   mySound = loadSound('assets/Damscray_DancingTiger.mp3');
 }

 function setup() {
   let cnv = createCanvas(100, 100);
   cnv.mousePressed(canvasPressed);
 }
 function canvasPressed() {
   mySound.loop();
 }
 function mouseReleased() {
   mySound.pause();
 }
 function draw() {
   background(220);

   // Set the rate to a range between 0.1 and 4
   // Changing the rate also alters the pitch
   let playbackRate = map(mouseY, 0.1, height, 2, 0);
   playbackRate = constrain(playbackRate, 0.01, 4);
   mySound.rate(playbackRate);

   line(0, mouseY, width, mouseY);
   text('rate: ' + round(playbackRate * 100) + '%', 10, 20);
 }

</code>
</div>