librosa.core.ifptrack

librosa.core.ifptrack(y, sr=22050, n_fft=2048, hop_length=None, fmin=None, fmax=None, threshold=0.75)

Instantaneous pitch frequency tracking.

Warning

Deprecated in librosa 0.4 ifptrack will be removed in 0.5. See piptrack for comparable functionality.

Parameters:

y: np.ndarray [shape=(n,)]

audio signal

sr : number > 0 [scalar]

audio sampling rate of y

n_fft: int > 0 [scalar]

FFT window size

hop_length : int > 0 [scalar] or None

Hop size for STFT. Defaults to n_fft / 4. See librosa.core.stft for details.

threshold : float in (0, 1)

Maximum fraction of expected frequency increment to tolerate

fmin : float or tuple of float

Ramp parameter for lower frequency cutoff.

If scalar, the ramp has 0 width.

If tuple, a linear ramp is applied from fmin[0] to fmin[1]

Default: (150.0, 300.0)

fmax : float or tuple of float

Ramp parameter for upper frequency cutoff.

If scalar, the ramp has 0 width.

If tuple, a linear ramp is applied from fmax[0] to fmax[1]

Default: (2000.0, 4000.0)

Returns:

pitches : np.ndarray [shape=(d, t)]

magnitudes : np.ndarray [shape=(d, t)]

Where d is the subset of FFT bins within fmin and fmax.

pitches[i, t] contains instantaneous frequencies at time t

magnitudes[i, t] contains their magnitudes.

D : np.ndarray [shape=(d, t), dtype=complex]

STFT matrix

Examples

>>> y, sr = librosa.load(librosa.util.example_audio_file())
>>> pitches, magnitudes, D = librosa.ifptrack(y, sr=sr)