Skip to content

Instantly share code, notes, and snippets.

@beefchimi
Last active October 22, 2017 23:49
Show Gist options
  • Save beefchimi/f8451d6407118e4ca379a86c247b5fff to your computer and use it in GitHub Desktop.
Save beefchimi/f8451d6407118e4ca379a86c247b5fff to your computer and use it in GitHub Desktop.
Speed method
speed(speed = 1) {
// Ramp up faster when increasing speed, slower if decreasing
const duration = (speed > 1) ? durationRamp.up : durationRamp.down;
for (let i = 0; i < this.trackCount; i++) {
this.sources[`source${i}`].playbackRate.exponentialRampToValueAtTime(
speed,
this.context.currentTime + duration
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment