Last active
April 15, 2022 18:27
-
-
Save waterjump/e8b9f124669436f9a5e313ebd1926596 to your computer and use it in GitHub Desktop.
Custom wave shaper node curve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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