Skip to content

Instantly share code, notes, and snippets.

@waterjump
Last active April 15, 2022 18:27
Show Gist options
  • Save waterjump/e8b9f124669436f9a5e313ebd1926596 to your computer and use it in GitHub Desktop.
Save waterjump/e8b9f124669436f9a5e313ebd1926596 to your computer and use it in GitHub Desktop.
Custom wave shaper node curve
// Creates a curve that goes from -1, -1 to 1, 0.
const makeLfoAmpCurve = function() {
let n_samples = 44100;
let curve = new Float32Array(n_samples)
let i = 0;
for ( ; i < n_samples; ++i ) {
curve[i] = i / (n_samples - 1) - 1;
}
return curve;
};
const lfoAmpWaveShaper = audioCtx.createWaveShaper();
lfoAmpWaveShaper.curve = makeLfoAmpCurve();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment