Created
June 3, 2018 15:59
-
-
Save soerface/c7bd151bde9ed73f59d8411baf3b016b 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
const {random, sin, PI, pow} = Math | |
this.t += 1 / 44100 | |
const freq = noteNumber => pow(2, (noteNumber-69) / 12) * 440 | |
const lowPass = (name, v, amount) => { | |
amount = amount ? amount : 1; | |
const val = (this[name] * amount + v) / (amount + 1) | |
this[name] = val; | |
return val; | |
} | |
const envelope = lowPass('asdfa', keys.length < 0 ? 1 : 0, 100000000) | |
return ( | |
sin(2 * PI * this.t * freq((keys[0] || 0))) * knobs.lol * envelope | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment