Chorus.create constructor
Chorus.create({})
Implementation
factory Chorus.create({required int sampleRate,
required double delay,
required double depth,
required double frequency})
{
List<double> delayTable = List<double>.filled((sampleRate / frequency).round(), 0);
for (var t = 0; t < delayTable.length; t++)
{
var phase = 2 * pi * t / delayTable.length;
delayTable[t] = sampleRate * (delay + depth * sin(phase));
}
int sampleCount = ((sampleRate * (delay + depth)) + 2).toInt();
return Chorus(
bufferL: List<double>.filled(sampleCount, 0),
bufferR: List<double>.filled(sampleCount, 0),
delayTable: delayTable,
bufferIndexL: 0,
bufferIndexR: 0,
delayTableIndexL: 0,
delayTableIndexR: delayTable.length ~/ 4);
}