Detects the pitch of an audio snippet
Detects the pitch of a signal using the autocorrelation method.
var detectPitch = require"detect-pitch"var n = 1024var signal = nvar omega = 2.0 * MathPI / nforvar i=0; i<n; ++isignali = Mathsin100 * i * omegaconsole.logdetectPitchsignal//Prints out://// 100//
npm install detect-pitch
Detects the pitch of
signal is a (possibly windowed) snippet of an audio signal. Represented as either a typed array or an ndarray.
options is an object containing optional arguments to the function:
options.thresholda float between
[0,1]that determines how intense a peak needs to be before it is consider a pitch. (Default
options.start_binan integer representing 1/lowest freqeuency. (Default
Returns The frequency of the pitch of the signal. To recover the period compute
pitch / signal.length
(c) 2013 Mikola Lysenko. MIT License