Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@davidreyburn
davidreyburn / lfo.pde
Created August 5, 2017 15:01
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;
}