swipe

Description: libf0 SWIPE implementation
Contributors: Sebastian Rosenzweig, Vojtěch Pešek, Simon Schwär, Meinard Müller
License: The MIT license, https://opensource.org/licenses/MIT
This file is part of libf0.
libf0.swipe.swipe(x, Fs=22050, H=256, F_min=55.0, F_max=1760.0, dlog2p=0.010416666666666666, derbs=0.1, strength_threshold=0)[source]

Implementation of a sawtooth waveform inspired pitch estimator (SWIPE). This version of the algorithm follows the original implementation, see swipe_slim for a more efficient alternative.

1

Arturo Camacho and John G. Harris, “A sawtooth waveform inspired pitch estimator for speech and music.” The Journal of the Acoustical Society of America, vol. 124, no. 3, pp. 1638–1652, Sep. 2008

Parameters
  • x (ndarray) – Audio signal

  • Fs (int) – Sampling rate

  • H (int) – Hop size

  • F_min (float or int) – Minimal frequency

  • F_max (float or int) – Maximal frequency

  • dlog2p (float) – resolution of the pitch candidate bins in octaves (default value = 1/96 -> 96 bins per octave)

  • derbs (float) – resolution of the ERB bands (default value = 0.1)

  • strength_threshold (float) – confidence threshold [0, 1] for the pitch detection (default value = 0)

Returns

  • f0 (ndarray) – Estimated F0-trajectory

  • t (ndarray) – Time axis

  • strength (ndarray) – Confidence/Pitch Strength

libf0.swipe.nyquist(Fs)[source]

Nyquist Frequency

libf0.swipe.F_coef(k, N, Fs)[source]

Physical frequency of STFT coefficients

libf0.swipe.T_coef(m, H, Fs)[source]

Physical time of STFT coefficients

libf0.swipe.stft_with_f_t(y, N, H, Fs)[source]

STFT wrapper

libf0.swipe.hz2erbs(hz)[source]

Convert Hz to ERB scale

libf0.swipe.erbs2hz(erbs)[source]

Convert ERB to Hz

libf0.swipe.pitch_strength_all_candidates(ferbs, loudness, pitch_candidates)[source]

Compute pitch strength for all pitch candidates

libf0.swipe.pitch_strength_one(erbs_frequencies, normalized_loudness, pitch_candidate)[source]

Compute pitch strength for one pitch candidate

libf0.swipe.resample_ferbs(spectrum, f, ferbs)[source]

Resample to ERB scale

libf0.swipe.resample_time(pitch_strength, resampled_time, ti)[source]

Resample time axis

libf0.swipe.interpolate_one_candidate(pitch_strength, ti, resampled_time)[source]

Interpolate time axis

libf0.swipe.parabolic_int(pitch_strength, strength_threshold, pc)[source]

Parabolic interpolation between pitch candidates using pitch strength

libf0.swipe.primes(n)[source]

Returns a set of n prime numbers