mfcc#

diffsptk.MFCC#

alias of MelFrequencyCepstralCoefficientsAnalysis

class diffsptk.MelFrequencyCepstralCoefficientsAnalysis(mfcc_order, n_channel, fft_length, sample_rate, lifter=1, out_format='y', **fbank_kwargs)[source]#

See this page for details.

Parameters:
mfcc_orderint >= 1 [scalar]

Order of MFCC, \(M\).

n_channelint >= 1 [scalar]

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

fft_lengthint >= 2 [scalar]

Number of FFT bins, \(L\).

sample_rateint >= 1 [scalar]

Sample rate in Hz.

lifterint >= 1 [scalar]

Liftering coefficient.

f_minfloat >= 0 [scalar]

Minimum frequency in Hz.

f_maxfloat <= sample_rate // 2 [scalar]

Maximum frequency in Hz.

floorfloat > 0 [scalar]

Minimum mel-filter bank output in linear scale.

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

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

forward(x)[source]#

Compute MFCC.

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

Power spectrum.

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

MFCC without C0.

ETensor [shape=(…, 1)]

Energy.

cTensor [shape=(…, 1)]

C0.

Examples

>>> x = diffsptk.ramp(19)
>>> stft = diffsptk.STFT(frame_length=10, frame_period=10, fft_length=32)
>>> mfcc = diffsptk.MFCC(4, 8, 32, 8000)
>>> y = mfcc(stft(x))
>>> y
tensor([[-7.7745e-03, -1.4447e-02,  1.6157e-02,  1.1069e-03],
        [ 2.8049e+00, -1.6257e+00, -2.3566e-02,  1.2804e-01]])

See also

stft fbank