Tone.js icon indicating copy to clipboard operation
Tone.js copied to clipboard

Random LFO shapes

Open boonier opened this issue 3 years ago • 1 comments

The feature you'd like A class much like SuperCollider's LFNoise0 (stepped noise) or LFNoise1 (interpolated ramped noise) for adding some natural jitter and randomisation to a signal or control.

Any alternatives you've considered Perhaps this can be achieve currently by creating a DC signal and enveloping with rampTo? Or sample and holding a white noise, and applying a low pass filter to smooth it? I've not ventured down that path quite yet, but I wanted to ask if something existed already, or I've overlooked it.

boonier avatar Nov 08 '21 12:11 boonier

applying a low pass filter to smooth it?

That's basically what I've been doing. I've been using a combination of a scheduled repeat -> random value -> signal -> low pass filter to create smooth random movement.

let signal = new Tone.Signal(0.5);
Tone.Transport.scheduleRepeat(time => {
  signal.setValueAtTime(Math.random(), time);
}, "16n");
let filter = new Tone.Filter(0.4, "lowpass");
signal.chain(filter);
// filter output is now smooth random signal

For a kind of stepped noise, you can remove the LPF.

Here's a CodePen with my most commonly used signal-based modulators. https://codepen.io/joeweiss/pen/VwMqrYx

image

joeweiss avatar Jan 17 '22 19:01 joeweiss