Created
June 25, 2019 09:08
-
-
Save rumblesan/8098306a0c71d2e7d9e78ff2fb094f90 to your computer and use it in GitHub Desktop.
This file contains 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
var ctx = new AudioContext(); | |
var osc1 = audioCtx.createOscillator(); | |
osc1.type = 'square'; | |
osc1.frequency.setValueAtTime(440, ctx.currentTime); | |
osc1.start(); | |
var osc2 = audioCtx.createOscillator(); | |
osc2.type = 'square'; | |
osc2.frequency.setValueAtTime(441, ctx.currentTime); | |
osc2.start(); | |
var gainNode = audioCtx.createGain(); | |
gainNode.gain.setValueAtTime(0.3, ctx.currentTime); | |
gainNode.connect(ctx.destination); | |
osc1.connect(gainNode); | |
osc2.connect(gainNode); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment