1.0.0 • Published 8 months ago

estimate-fundamental-frequency v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Estimate fundamental frequency

Fundamental frequency detection with (a slightly modified version of) the YIN Algorithm. The difference is that it does not use the global threshold if no local minimum is found.

A demo with the microphone as input can be found at https://www.amefi.no/projects/tuner.

Installation

npm install estimate-fundamental-frequency

Usage

import { estimateFundamentalFrequency } from "estimate-fundamental-frequency";

const data = new Float32Array(1024);

const sampleRate = 44100;
const frequency = 440;

for (let i = 0; i < data.length; i++) {
  data[i] = Math.sin((2 * Math.PI * frequency * i) / sampleRate);
}

const estimatedFrequency = estimateFundamentalFrequency(data, 44100);

License

MIT