working with WebAudio API and trying to get distortion going! Issue is, I'm not sure how to get into the "curve" param of WaveShaper.
Simply put, 'oscidis' is a WaveShaper node created earlier in the program. Oscidisv is a value I have set to 0 statically, for now.:
const wsCurve = new Float32Array();
if (oscidisv >= -1 && oscidisv < 1) {
const k = (2 * oscidisv) / (1 - oscidisv);
for (let i = 0; i < 16; i += 1) {
// LINEAR INTERPOLATION:
// x = (c - a) * (z - y) / (b - a) + y
// given
// a = 0, b = 2048, z = 1, y = -1, c = i
const x = ((i - 0) * (1 - -1)) / (16 - 0) + -1;
wsCurve[i] = ((1 + k) * x) / (1 + k * Math.abs(x));
}
}
oscidis.curve.value = wsCurve;
The issue - I'm not hearing any difference in sound regardless of what I put here )-=. I don't notice any real distortion even with the distortion at max (1). Do you guys know anything about a more noticeable distortion waveshaping function? Or if I'm doing this right at all in the WebAudio API?