r9y9 / pysptk

A python wrapper for Speech Signal Processing Toolkit (SPTK).
http://pysptk.readthedocs.io/en/latest/
Other
441 stars 79 forks source link

f0 and pitch #78

Closed wyp19930313 closed 4 years ago

wyp19930313 commented 4 years ago

Hello, I want to know what is the conversion relationship between f0 and pitch? I run the same data to get f0 and pitch, which are different from the conversion relationship I know.

f0 = pysptk.swipe(data.astype(np.float64), fs=16000, hopsize=80, min=60, max=200, otype="f0") pitch = pysptk.swipe(data.astype(np.float64), fs=16000, hopsize=80, min=60, max=200, otype="pitch") f0[:6]

Out[4]: array([ 60. , 60. , 60. , 196.24851072, 194.48506966, 0. ])

pitch[:6] Out[5]: array([266.66666667, 266.66666667, 266.66666667, 81.52928112, 82.26852595, 0. ])

r9y9 commented 4 years ago

pitch is defined as 1) sample_rate / f0 (for voiced regions), and 2) 0 (for unvoiced regions).

See https://github.com/r9y9/SPTK/blob/master/bin/pitch/swipe/swipe.c#L562-L564 for exact code for the conversion.

wyp19930313 commented 4 years ago

I understand, thank you very much for your answer.