Skip to content

Instantly share code, notes, and snippets.

View BenKnisley's full-sized avatar

Ben Knisley BenKnisley

View GitHub Profile
@BenKnisley
BenKnisley / gist:4f74d5861945c67f604f4ac12601e26d
Created April 17, 2018 14:27 — forked from sebpiq/gist:4128537
Python implementation of the Goertzel algorithm for calculating DFT terms
import math
def goertzel(samples, sample_rate, *freqs):
"""
Implementation of the Goertzel algorithm, useful for calculating individual
terms of a discrete Fourier transform.
`samples` is a windowed one-dimensional signal originally sampled at `sample_rate`.
The function returns 2 arrays, one containing the actual frequencies calculated,