sine static method

Float32List sine({
  1. required int n,
  2. required double freqHz,
  3. required double sampleRate,
  4. double amplitude = 1.0,
  5. double phaseRad = 0.0,
})

Implementation

static Float32List sine({
  required int n,
  required double freqHz,
  required double sampleRate,
  double amplitude = 1.0,
  double phaseRad = 0.0,
}) {
  final out = Float32List(n);
  final w = 2.0 * math.pi * freqHz / sampleRate;

  for (int i = 0; i < n; i++) {
    out[i] = (amplitude * math.sin(w * i + phaseRad));
  }
  return out;
}