Example #1
0
 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();
 }
Example #2
0
 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();
 }
Example #3
0
 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));