noiseFor function
Noise for a loop d seconds long (pass 0 for one-shots).
Implementation
FireNoiseFn noiseFor(double d) {
if (d == 0.0) {
return (tt, rate, [seed = 0, off = 0.0]) => noise(tt * rate + off, seed);
}
return (tt, rate, [seed = 0, off = 0.0]) {
final p = math.max(1, (rate * d).round());
return pnoise((tt / d) * p + off, p, seed);
};
}