pysptk.sptk.rapt

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

RAPT - a robust algorithm for pitch tracking

Parameters
xarray, dtype=np.float32

A whole audio signal

fsint

Sampling frequency.

hopsizeint

Hop size.

minfloat, optional

Minimum fundamental frequency. Default is 60.0

maxfloat, optional

Maximum fundamental frequency. Default is 240.0

voice_biasfloat, optional

Voice/unvoiced threshold. Default is 0.0.

otypestr or int, optional
Output format
  1. pitch

  2. f0

  3. log(f0)

Default is f0.

Returns
f0array, 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