plp#

diffsptk.PLP#

alias of PerceptualLinearPredictiveCoefficientsAnalysis

class diffsptk.PerceptualLinearPredictiveCoefficientsAnalysis(plp_order, n_channel, fft_length, sample_rate, lifter=1, compression_factor=0.33, n_fft=512, out_format='y', **fbank_kwargs)[source]#

See this page for details.

Parameters:
mfcc_orderint >= 1

Order of MFCC, \(M\).

n_channelint >= 1

Number of mel-filter banks, \(C\).

fft_lengthint >= 2

Number of FFT bins, \(L\).

sample_rateint >= 1

Sample rate in Hz.

lifterint >= 1

Liftering coefficient.

compression_factorfloat > 0

Amplitude compression factor.

f_minfloat >= 0

Minimum frequency in Hz.

f_maxfloat <= sample_rate // 2

Maximum frequency in Hz.

floorfloat > 0

Minimum mel-filter bank output in linear scale.

n_fftint >> M

Number of FFT bins. Accurate conversion requires the large value.

out_format[‘y’, ‘yE’, ‘yc’, ‘ycE’]

y is MFCC, c is C0, and E is energy.

References

[1]
  1. Young et al., “The HTK Book,” Cambridge University Press, 2006.

forward(x)[source]#

Compute PLP.

Parameters:
xTensor [shape=(…, L/2+1)]

Power spectrum.

Returns:
yTensor [shape=(…, M)]

PLP without C0.

ETensor [shape=(…, 1)] (optional)

Energy.

cTensor [shape=(…, 1)] (optional)

C0.

Examples

>>> x = diffsptk.ramp(19)
>>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=32)
>>> plp = diffsptk.PLP(4, 8, 32, 8000)
>>> y = plp(stft(x))
>>> y
tensor([[-0.2896, -0.2356, -0.0586, -0.0387],
        [ 0.4468, -0.5820,  0.0104, -0.0505]])

See also

stft fbank mfcc