utils

Description: libf0 utility functions
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.utils.sonify_trajectory_with_sinusoid(f0, t, audio_len, confidence=None, Fs=22050, smooth_len=11)[source]

Sonification of trajectory with sinusoidal. Adapted from FMP notebook: C8/C8S2_FundFreqTracking.ipynb

Parameters
  • f0 (ndarray) – F0-trajectory

  • t (ndarray) – Time axis

  • audio_len (int) – Desired audio length in samples

  • confidence (None or ndarray) – Confidence values for amplitude control

  • Fs (int) – Sampling rate

  • smooth_len (int) – Smoothing filter length to avoid clicks in the sonification

Returns

x_soni – Sonified F0-trajectory

Return type

ndarray

libf0.utils.hz_to_cents(F, F_ref=55.0)[source]

Converts frequency in Hz to cents.

Parameters
  • F (float or ndarray) – Frequency value in Hz

  • F_ref (float) – Reference frequency in Hz (Default value = 55.0)

Returns

F_cents – Frequency in cents

Return type

float or ndarray

libf0.utils.cents_to_hz(F_cents, F_ref=55.0)[source]

Converts frequency in cents to Hz.

Parameters
  • F_cents (float or ndarray) – Frequency in cents

  • F_ref (float) – Reference frequency in Hz (Default value = 55.0)

Returns

F – Frequency in Hz

Return type

float or ndarray