Goertzel TONE(440.0);

Hi
The code is taken from here
https://github.com/AI5GW/Goertzel/tree/main
and it has compiling errors

/*
 *  SingleTone.ino - Goertzel library example
 *
 * Copyright (C) 2022 Sebastian Westerhold (AI5GW) <sebastian@baltic-lab.com>
 * Web (EN): https://baltic-lab.com
 * Web (DE): https://baltic-labor.de/
 * YouTube (EN): https://www.youtube.com/c/BalticLab
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

// Define the ADC midpoint (512 is the default)
#define ADC_MIDPOINT 512

// Define the sample rate (8800 S/s is the default for 16 MHz Boards)
#define SAMPLE_RATE 8800

// include the Goertzel library
#include <Goertzel.h>

// Array buffer for ADC samples
int Samples[100];

// Variable for resulting magnitude
float Mag;

// Instantiate class for 440 Hz tone detection
Goertzel TONE(440.0);

void setup() {
  Serial.begin(9600);
}

void loop() {

  // Get 100 ADC samples from A1 and store them in the buffer
  for (int n = 0; n < 100; n++) {
    Samples[n] = analogRead(A1);
  }

  // get the magnitude of the 440 Hz tone
  // The second parameter is the amount of samples passed to the class function
  Mag = TONE.Mag(Samples, 100);

  // print result to serial
  Serial.println(Mag);
}

errors Arduino uno

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"

Warning: Board New folder:arduino:uno doesn't define a 'build.board' preference. Auto-set to: ARDUINO_UNO

Warning: Board New folder:arduino:fio doesn't define a 'build.board' preference. Auto-set to: ARDUINO_FIO

Warning: Board New folder:arduino:atmega168 doesn't define a 'build.board' preference. Auto-set to: ARDUINO_ATMEGA168

Warning: Board New folder:arduino:nano doesn't define a 'build.board' preference. Auto-set to: ARDUINO_NANO

Warning: Board New folder:arduino:lilypad328 doesn't define a 'build.board' preference. Auto-set to: ARDUINO_LILYPAD328

Warning: Board New folder:arduino:mega doesn't define a 'build.board' preference. Auto-set to: ARDUINO_MEGA

Warning: Board New folder:arduino:bt doesn't define a 'build.board' preference. Auto-set to: ARDUINO_BT

Warning: Board New folder:arduino:pro328 doesn't define a 'build.board' preference. Auto-set to: ARDUINO_PRO328

Warning: Board New folder:arduino:pro doesn't define a 'build.board' preference. Auto-set to: ARDUINO_PRO

Warning: Board New folder:arduino:lilypad doesn't define a 'build.board' preference. Auto-set to: ARDUINO_LILYPAD

Warning: Board New folder:arduino:diecimila doesn't define a 'build.board' preference. Auto-set to: ARDUINO_DIECIMILA

Warning: Board New folder:arduino:pro5v doesn't define a 'build.board' preference. Auto-set to: ARDUINO_PRO5V

Warning: Board New folder:arduino:atmega328 doesn't define a 'build.board' preference. Auto-set to: ARDUINO_ATMEGA328

Warning: Board New folder:arduino:mini328 doesn't define a 'build.board' preference. Auto-set to: ARDUINO_MINI328

Warning: Board New folder:attiny:attiny44-8 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY44-8

Warning: Board New folder:attiny:attiny44-20 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY44-20

Warning: Board New folder:attiny:attiny45-8 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY45-8

Warning: Board New folder:attiny:attiny85-20 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY85-20

Warning: Board New folder:attiny:attiny45-20 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY45-20

Warning: Board New folder:attiny:attiny84-8 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY84-8

Warning: Board New folder:attiny:attiny84-20 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY84-20

Warning: Board New folder:attiny:attiny85 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY85

Warning: Board New folder:attiny:attiny85-8 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY85-8

Warning: Board New folder:attiny:attiny44 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY44

Warning: Board New folder:attiny:attiny84 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY84

Warning: Board New folder:attiny:attiny45 doesn't define a 'build.board' preference. Auto-set to: ATTINY_ATTINY45

goertzel_4:39:20: error: no matching function for call to 'Goertzel::Goertzel(double)'

 Goertzel TONE(440.0);

                    ^

In file included from C:\Users\Galinka\Documents\Arduino\goertzel_4\goertzel_4.ino:30:0:

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:35:5: note: candidate: Goertzel::Goertzel(float, float)

     Goertzel(float,float);

     ^~~~~~~~

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:35:5: note:   candidate expects 2 arguments, 1 provided

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:34:5: note: candidate: Goertzel::Goertzel(float, float, float)

     Goertzel(float,float,float);

     ^~~~~~~~

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:34:5: note:   candidate expects 3 arguments, 1 provided

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:30:7: note: candidate: constexpr Goertzel::Goertzel(const Goertzel&)

 class Goertzel

       ^~~~~~~~

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:30:7: note:   no known conversion for argument 1 from 'double' to 'const Goertzel&'

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:30:7: note: candidate: constexpr Goertzel::Goertzel(Goertzel&&)

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:30:7: note:   no known conversion for argument 1 from 'double' to 'Goertzel&&'

C:\Users\Galinka\Documents\Arduino\goertzel_4\goertzel_4.ino: In function 'void loop()':

goertzel_4:54:14: error: 'class Goertzel' has no member named 'Mag'

   Mag = TONE.Mag(Samples, 100);

              ^~~

exit status 1

no matching function for call to 'Goertzel::Goertzel(double)'




sounds like an issue with the IDE and the boards' definitions.

I fixed it by uploading library from linkedin page. Testing results are not good

  1. no goertzel effect = magnitude almost not depends to signal frequency.
  2. changing ADC MIDPOINT 512 to another number is not affecting
    Serial.println(Mag);
In file included from C:\Users\Galinka\Documents\Arduino\goertzel_4\goertzel_4.ino:30:0:

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:35:5: note: candidate: Goertzel::Goertzel(float, float)

     Goertzel(float,float);

     ^~~~~~~~

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:35:5: note:   candidate expects 2 arguments, 1 provided

C:\Users\Galinka\Documents\Arduino\libraries\Goertzel-master/Goertzel.h:34:5: note: candidate: Goertzel::Goertzel(float, float, float)

     Goertzel(float,float,float);

     ^~~~~~~~

could indicate that you are using an example from this library https://github.com/AI5GW/Goertzel/tree/main
using the Goertzel.h from this library
https://github.com/jacobrosenthal/Goertzel/tree/master

after installing this one I have no errors,

I had errors when only the second library was installed