swipe_slim

Description: libf0 SWIPE slim implementation
Contributors: Sebastian Rosenzweig, Simon Schwär, Meinard Müller
License: The MIT license, https://opensource.org/licenses/MIT
This file is part of libf0.
libf0.swipe_slim.swipe_slim(x, Fs=22050, H=256, F_min=55.0, F_max=1760.0, R=10, strength_threshold=0)[source]

Slim and didactical implementation of a sawtooth waveform inspired pitch estimator (SWIPE). This version uses a log-frequency spectrogram instead of ERB filters. Furthermore, it is implemented more efficiently. See swipe() for the original implementation.

1

A. Camacho and J. 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

  • R (float) – resolution of the pitch candidate bins in cents (default = 10)

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

Returns

  • f0 (ndarray) – Estimated F0-trajectory

  • t (ndarray) – Time axis

  • conf (ndarray) – Confidence / Pitch Strength

libf0.swipe_slim.compute_kernel(f, F_coef_log_hz)[source]

Compute a SWIPE’ kernel.

Parameters
  • f (float) – Frequency in Hz

  • F_coef_log_hz – Logarithmic frequency axis in Hz

Returns

k – Kernel

Return type

ndarray

libf0.swipe_slim.prime_and_one(upto=1000000)[source]

Returns a set of prime numbers, adapted from http://rebrained.com/?p=458

Parameters

upto (int) – Find prime numbers up to this number

Return type

A set of prime numbers including 1 & 2