pysptk.sptk.rapt

pysptk.sptk.rapt(x, fs, hopsize, min=60, max=240, voice_bias=0.0, otype='f0')

RAPT - a robust algorithm for pitch tracking

Parameters:

x : array, dtype=np.float32

A whole audio signal

fs : int

Sampling frequency.

hopsize : int

Hop size.

min : float, optional

Minimum fundamental frequency. Default is 60.0

max : float, optional

Maximum fundamental frequency. Default is 240.0

voice_bias : float, optional

Voice/unvoiced threshold. Default is 0.0.

otype : str or int, optional

Output format
  1. pitch
  2. f0
  3. log(f0)

Default is f0.

Returns:

f0 : array, shape(np.ceil(float(len(x))/hopsize))

Estimated f0 trajectory

Raises:

ValueError

  • if invalid min/max frequency specified
  • if invalid frame period specified (not in [1/fs, 0.1])
  • if input range too small for analysis by get_f0

RuntimeError

  • problem in init_dp_f0()

Please see also the RAPT code in SPTK for more detailed exception conditions.

Notes

It is assumed that input array x has np.float32 dtype, while swipe assumes np.float64 dtype.

Examples