# Goertzel Algorithm

Started by February 13, 2006
```Goertzel's Algorithm was recommended in a previous topic. I've found
some C code that will get me going really quickly. I was wondering
whether the samples have to be centered around zero? Or can they be
used directly from an ADC (i.e. range from 0 to 255 or so and be

Thanks,

John

```
```jecottrell@comcast.net wrote:
> Goertzel's Algorithm was recommended in a previous topic. I've found
> some C code that will get me going really quickly. I was wondering
> whether the samples have to be centered around zero? Or can they be
> used directly from an ADC (i.e. range from 0 to 255 or so and be
> centered about 128?)

The offset amounts to a strong DC component. It may make numeric
problems -- overflow ans all that -- but it should otherwise not
interfere. It's easy to convert offset binary to signed binary. Just
subtract half the (maximum + 1) or, what amounts to the same thing,
invert the most significant bit. Some ADCs can be set up to invert the
MSB internally.

jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Excellent. As I was converting the code I noticed that the variable for
the data was unsigned. So, the pre-written code is set up for exactly
what I've got.

I'll be on the look-out for the problems you've mentioned.

Thanks,

John

```