Created
October 3, 2014 15:21
-
-
Save khoin/4e5549bdf3abdb714c42 to your computer and use it in GitHub Desktop.
Some wavepot fiddling
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
function dsp(t) { | |
var si = 0.5 * sin(t, 880 * t%2); | |
var sq = sqr(t,445 + 10 * sin(t, 0.1) ) * (0.5 + si); | |
return 1*saw(t,sampleRate/(41 + 20 * sin(t, 0.01 )) ) * si + 0.3 * sq; | |
} | |
function saw(t,freq) { | |
return (0.5-((t*sampleRate)%freq)/freq)*1.5 ; | |
} | |
function sin(t,f) { | |
return Math.sin(Math.PI*2*t * f); | |
} | |
function sqr (t,f) { | |
return sin(t,f) > 0 ? 1 : -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment