Skip to content

Typescript library for finding the fundamental frequency of a signal

License

Notifications You must be signed in to change notification settings

adrianmfi/estimate-fundamental-frequency

Repository files navigation

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

About

Typescript library for finding the fundamental frequency of a signal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published