Created
January 12, 2016 08:40
-
-
Save s3thi/e94e198c6e8ba7aa3635 to your computer and use it in GitHub Desktop.
sampler.js – GainNode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
playSample() { | |
let bufferSource = this.audioContext.createBufferSource(); | |
bufferSource.buffer = this.audioBuffer; | |
bufferSource.playbackRate.value = this.playbackRate; | |
let gainNode = this.audioContext.createGain(); | |
gainNode.gain.value = this.gain; | |
bufferSource.connect(gainNode); | |
gainNode.connect(this.audioContext.destination); | |
bufferSource.start(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment