pitch_garden.ranges#

class pitch_garden.ranges.log_normal.LogNormalRangeEstimator(gamma: float = 3.0, min_octaves: float = 0.5)[source]#

An estimator giving [exp(mu - gamma * sigma), exp(mu + gamma * sigma)].

The voiced F0 is assumed to follow a log-normal distribution, where mu and sigma are the mean and the standard deviation of log F0, respectively.

estimate(values: ndarray) → tuple[float, float][source]#

Estimate the F0 search range.

Parameters:
valuesnp.ndarray

The voiced F0 values in Hz.

Returns:
outtuple[float, float]

The lower and upper bounds in Hz.

class pitch_garden.ranges.base.F0Range(fmin: float, fmax: float, num_voiced_frames: int, fallback: bool = False)[source]#

Dataclass to hold an estimated F0 search range.

to_dict() → dict[str, Any][source]#

Convert to a dictionary for serialization.

Returns:
outdict[str, Any]

The dictionary of plain Python objects.

class pitch_garden.ranges.base.BaseRangeEstimator(min_octaves: float = 0.5)[source]#

An abstract base class for F0 range estimators.

abstractmethod estimate(values: ndarray) → tuple[float, float][source]#

Estimate the F0 search range.

Parameters:
valuesnp.ndarray

The voiced F0 values in Hz.

Returns:
outtuple[float, float]

The lower and upper bounds in Hz.