Merge pull request #2 from dnrhead/goertzelfix
authorTomas Mudrunka <tomas@mudrunka.cz>
Thu, 19 Jul 2018 15:10:58 +0000 (17:10 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Jul 2018 15:10:58 +0000 (17:10 +0200)
Goertzelfix

c/goertzel/goertzel.c

index 2cde63bfe2a015ef2ec398c99c3d69a1f958b3d5..d13a874d9612379d94ca4e07c7de72da16ea7294 100644 (file)
@@ -29,8 +29,8 @@ float goertzel_mag(int numSamples,float TARGET_FREQUENCY,int SAMPLING_RATE, floa
 
     // calculate the real and imaginary results
     // scaling appropriately
-    real = (q1 - q2 * cosine) / scalingFactor;
-    imag = (q2 * sine) / scalingFactor;
+    real = (q1 * cosine - q2) / scalingFactor;
+    imag = (q1 * sine) / scalingFactor;
 
     magnitude = sqrtf(real*real + imag*imag);
     return magnitude;
This page took 0.141798 seconds and 4 git commands to generate.