Skip to content

Instantly share code, notes, and snippets.

@davidreyburn
Created August 5, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidreyburn/1af1d704897bcb9d946e9d063c4fbd8b to your computer and use it in GitHub Desktop.
Save davidreyburn/1af1d704897bcb9d946e9d063c4fbd8b to your computer and use it in GitHub Desktop.
a simple function in processing which takes a float, uses that as the amplitude of a wave, and returns a smoothly undulating value
float lfo(float amplitude) {
float x = sin(theta) * amplitude;
theta = theta + 0.01;
if (theta > 2 * PI) {
theta = 0.0;
}
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment