public LessStatefulDetector() { sampleRate = 8000; numSamples = 205; threshold = 35.0; initLoResps = lowTones.Select(f => Goertzel.Init(f, sampleRate, numSamples)).ToArray(); initHiResps = highTones.Select(f => Goertzel.Init(f, sampleRate, numSamples)).ToArray(); }
public LinqedDetector() { sampleRate = 8000; numSamples = 205; threshold = 35.0; lows = lowTones.Select(f => Goertzel.Init(f, sampleRate, numSamples)).ToArray(); highs = highTones.Select(f => Goertzel.Init(f, sampleRate, numSamples)).ToArray(); }
public static Goertzel MeasureFrequency(this IEnumerable <float> samples, int targetFreq) => samples .Take(Config.Default.SampleBlockSize) .Aggregate( Goertzel.Init(targetFreq, Config.Default.SampleRate, Config.Default.SampleBlockSize), (g, s) => g.AddSample(s));