Last active
January 11, 2021 16:47
-
-
Save arturparkhisenko/55d3260a7639d1aeb793ee122c58b334 to your computer and use it in GitHub Desktop.
js fun
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
// https://twitter.com/MylesBorins/status/929414418680643585?s=09 | |
const context = new window.AudioContext(); | |
for (let i = 0; i < 10; i++) { | |
let osc = context.createOscillator(); | |
osc.type = 'square'; | |
osc.frequency.value = 40 + i * 0.1111; | |
osc.connect(context.destination); | |
osc.start(); | |
} | |
// second part | |
const context = new window.AudioContext(); | |
for (let i = 0; i < 100; i++) { | |
let osc = context.createOscillator(); | |
osc.type = 'sawtooth'; | |
osc.frequency.value = 40 + i * 0.0111; | |
osc.connect(context.destination); | |
osc.start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment