Skip to content

Instantly share code, notes, and snippets.

@devin-dominguez
Last active May 10, 2019 19:43
Show Gist options
  • Save devin-dominguez/dca05cbf8b1afb516ce190be83b0a43c to your computer and use it in GitHub Desktop.
Save devin-dominguez/dca05cbf8b1afb516ce190be83b0a43c to your computer and use it in GitHub Desktop.
easy phase distortion oscillator
phasor -> variable angle unipolar triangle function -> * 0.5 -> cosine lookup
adjust the angle on the triangle to morph between sine and pseudo-saw
can offset saw phase and subtract to get a psuedo-square (as per ususal)
triangle function:
angle range 0 to 1 with 0.5 being symetrical
if (phase <= angle) phase / angle
if (phase > angle) phase - 1 / angle -1
by scaling by 0.5 we get the first half of the cosine, and then that same first half but in reverse (which is == to the 2nd half)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment