ap#

class diffsptk.Aperiodicity(frame_period, sample_rate, fft_length, algorithm='tandem', out_format='a', **kwargs)[source]#

See this page for details.

Parameters:
frame_periodint >= 1 [scalar]

Frame period, \(P\).

sample_rateint >= 1 [scalar]

Sample rate in Hz.

fft_lengthint [scalar]

Size of double-sided aperiodicity, \(L\).

algorithm[‘tandem’]

Algorithm.

out_format[‘a’, ‘p’, ‘a/p’, ‘p/a’]

Output format.

lower_boundfloat >= 0 [scalar]

Lower bound of aperiodicity.

upper_boundfloat <= 1 [scalar]

Upper bound of aperiodicity.

window_length_msint >= 1 [scalar]

Window length in msec.

epsfloat > 0 [scalar]

A number used to stabilize colesky decomposition.

forward(x, f0)[source]#

Compute aperiodicity measure.

Parameters:
xTensor [shape=(B, T) or (T,)]

Waveform.

f0Tensor [shape=(B, N) or (N,)]

F0 in Hz.

Returns:
apTensor [shape=(B, N, L/2+1) or (N, L/2+1)]

Aperiodicity.

Examples

>>> x = diffsptk.sin(100, 10)
>>> pitch = diffsptk.Pitch(80, 16000, out_format="f0")
>>> f0 = pitch(x)
>>> f0
tensor([1597.2064, 1597.2064])
>>> aperiodicity = diffsptk.Aperiodicity(80, 16000, 8)
>>> ap = aperiodicity(x, f0)
>>> ap
tensor([[0.0010, 0.0010, 0.1729, 0.1647, 0.1569],
        [0.0010, 0.0010, 0.0490, 0.0487, 0.0483]])

See also

excite