This is a PRNG, built on Jacob Rus' implementation and modified slightly for a user-friendly API.
See here for source: https://observablehq.com/@jrus/permuted-congruential-generator
float getBPMVis(float bpm){ | |
// this function can be found graphed out here :https://www.desmos.com/calculator/rx86e6ymw7 | |
float bps = 60./bpm; // beats per second | |
float bpmVis = tan((time*PI)/bps); | |
// multiply it by PI so that tan has a regular spike every 1 instead of PI | |
// divide by the beat per second so there are that many spikes per second | |
bpmVis = clamp(bpmVis,0.,10.); | |
// tan goes to infinity so lets clamp it at 10 | |
bpmVis = abs(bpmVis)/20.; |
This is a PRNG, built on Jacob Rus' implementation and modified slightly for a user-friendly API.
See here for source: https://observablehq.com/@jrus/permuted-congruential-generator