sawtooth static method
Implementation
static Float32List sawtooth({
required int n,
required double freqHz,
required double sampleRate,
double amplitude = 1.0,
}) {
final out = Float32List(n);
final period = sampleRate / freqHz;
for (int i = 0; i < n; i++) {
final phase = (i % period) / period;
out[i] = (amplitude * (2.0 * phase - 1.0));
}
return out;
}